Permalink
Browse files

Fix up line endings and add .gitattributes

  • Loading branch information...
avanderhoorn committed Oct 12, 2012
1 parent b2723cf commit 0303bc3e268565cf17bd968cf0607bb7b0dae89e
@@ -0,0 +1,19 @@
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto

# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text

# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.gif binary
*.ico binary
*.zip binary
*.msi binary
*.exe binary
@@ -1,90 +1,90 @@
using System;
using System.IO;
using System.Web;
using Glimpse.Core;
using Glimpse.Test.AspNet.Tester;
using Moq;
using Xunit;

namespace Glimpse.Test.AspNet
{
public class AspNetFrameworkProviderShould : IDisposable
{
private AspNetFrameworkProviderTester tester;

public AspNetFrameworkProviderTester FrameworkProvider
{
get { return tester ?? (tester = AspNetFrameworkProviderTester.Create()); }
set { tester = value; }
}

public void Dispose()
{
FrameworkProvider = null;
}

[Fact]
public void HaveARuntimeContextTypeOfHttpContextBase()
{
Assert.True(FrameworkProvider.RuntimeContext.GetType().IsSubclassOf(typeof (HttpContextBase)));
}

[Fact]
public void HaveARuntimeContext()
{
Assert.NotNull(FrameworkProvider.RuntimeContext);
Assert.True(FrameworkProvider.RuntimeContext is HttpContextBase);
}

[Fact]
public void HaveHttpRequestStore()
{
Assert.NotNull(FrameworkProvider.HttpRequestStore);
Assert.Equal(5, FrameworkProvider.HttpRequestStore.Get<int>());
Assert.Equal("TestString", FrameworkProvider.HttpRequestStore.Get<string>());
}

[Fact]
public void HaveHttpServerStore()
{
Assert.NotNull(FrameworkProvider.HttpServerStore);
Assert.Equal("testValue", FrameworkProvider.HttpServerStore.Get("testKey"));

FrameworkProvider.HttpApplicationStateMock.Verify(st => st.Get("testKey"), Times.Once());
}


[Fact]
public void SetHttpResponseHeader()
{
var headerName = "testKey";
var headerValue = "testValue";

FrameworkProvider.SetHttpResponseHeader(headerName, headerValue);

FrameworkProvider.HttpResponseMock.Verify(r=>r.AppendHeader(headerName, headerValue));
}

[Fact]
public void InjectHttpResponseBody()
{
var outputString = "<script src=\"test.js\"></script>";

FrameworkProvider.InjectHttpResponseBody(outputString);

FrameworkProvider.HttpContextMock.VerifyGet(ctx => ctx.Response);
FrameworkProvider.HttpResponseMock.VerifyGet(r => r.Filter);
FrameworkProvider.HttpResponseMock.VerifySet(r => r.Filter = It.IsAny<Stream>());
}

[Fact]
public void SetHttpResponseStatusCode()
{
var statusCode = 200;
FrameworkProvider.SetHttpResponseStatusCode(statusCode);

FrameworkProvider.HttpResponseMock.VerifySet(r => r.StatusCode = statusCode);
FrameworkProvider.HttpResponseMock.VerifySet(r => r.StatusDescription = null);
}
}
using System;
using System.IO;
using System.Web;
using Glimpse.Core;
using Glimpse.Test.AspNet.Tester;
using Moq;
using Xunit;

namespace Glimpse.Test.AspNet
{
public class AspNetFrameworkProviderShould : IDisposable
{
private AspNetFrameworkProviderTester tester;

public AspNetFrameworkProviderTester FrameworkProvider
{
get { return tester ?? (tester = AspNetFrameworkProviderTester.Create()); }
set { tester = value; }
}

public void Dispose()
{
FrameworkProvider = null;
}

[Fact]
public void HaveARuntimeContextTypeOfHttpContextBase()
{
Assert.True(FrameworkProvider.RuntimeContext.GetType().IsSubclassOf(typeof (HttpContextBase)));
}

[Fact]
public void HaveARuntimeContext()
{
Assert.NotNull(FrameworkProvider.RuntimeContext);
Assert.True(FrameworkProvider.RuntimeContext is HttpContextBase);
}

[Fact]
public void HaveHttpRequestStore()
{
Assert.NotNull(FrameworkProvider.HttpRequestStore);
Assert.Equal(5, FrameworkProvider.HttpRequestStore.Get<int>());
Assert.Equal("TestString", FrameworkProvider.HttpRequestStore.Get<string>());
}

[Fact]
public void HaveHttpServerStore()
{
Assert.NotNull(FrameworkProvider.HttpServerStore);
Assert.Equal("testValue", FrameworkProvider.HttpServerStore.Get("testKey"));

FrameworkProvider.HttpApplicationStateMock.Verify(st => st.Get("testKey"), Times.Once());
}


[Fact]
public void SetHttpResponseHeader()
{
var headerName = "testKey";
var headerValue = "testValue";

FrameworkProvider.SetHttpResponseHeader(headerName, headerValue);

FrameworkProvider.HttpResponseMock.Verify(r=>r.AppendHeader(headerName, headerValue));
}

[Fact]
public void InjectHttpResponseBody()
{
var outputString = "<script src=\"test.js\"></script>";

FrameworkProvider.InjectHttpResponseBody(outputString);

FrameworkProvider.HttpContextMock.VerifyGet(ctx => ctx.Response);
FrameworkProvider.HttpResponseMock.VerifyGet(r => r.Filter);
FrameworkProvider.HttpResponseMock.VerifySet(r => r.Filter = It.IsAny<Stream>());
}

[Fact]
public void SetHttpResponseStatusCode()
{
var statusCode = 200;
FrameworkProvider.SetHttpResponseStatusCode(statusCode);

FrameworkProvider.HttpResponseMock.VerifySet(r => r.StatusCode = statusCode);
FrameworkProvider.HttpResponseMock.VerifySet(r => r.StatusDescription = null);
}
}
}
@@ -1,90 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{76714E46-AFE9-49F0-AEE8-C8A966195914}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Glimpse.Test.AspNet</RootNamespace>
<AssemblyName>Glimpse.Test.AspNet</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Moq">
<HintPath>..\..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="xunit, Version=1.9.1.1600, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\xunit.1.9.1\lib\net20\xunit.dll</HintPath>
</Reference>
<Reference Include="xunit.extensions">
<HintPath>..\..\packages\xunit.extensions.1.9.1\lib\net20\xunit.extensions.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AspNetFrameworkProviderShould.cs" />
<Compile Include="HttpApplicationStateBaseDataAdapterShould.cs" />
<Compile Include="HttpHandlerShould.cs" />
<Compile Include="HttpModuleShould.cs" />
<Compile Include="IResourceEndpointConfiguration.cs" />
<Compile Include="Model\RequestModelShould.cs" />
<Compile Include="Model\RouteInstanceShould.cs" />
<Compile Include="Model\RouteInstanceTester.cs" />
<Compile Include="Policy\LocalPolicyShould.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SerializationConverter\RequestModelConverterShould.cs" />
<Compile Include="Tab\RequestShould.cs" />
<Compile Include="Tab\RoutesShould.cs" />
<Compile Include="Tester\AspNetFrameworkProviderTester.cs" />
<Compile Include="Tester\HttpHandlerTester.cs" />
<Compile Include="Tester\HttpModuleTester.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Glimpse.AspNet\Glimpse.AspNet.csproj">
<Project>{FDDFC8A6-CDDF-4BC6-9F07-E76050E1EEE7}</Project>
<Name>Glimpse.AspNet</Name>
</ProjectReference>
<ProjectReference Include="..\Glimpse.Core\Glimpse.Core.csproj">
<Project>{C1289CE8-3259-41D9-893E-7A4E6F772D30}</Project>
<Name>Glimpse.Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{76714E46-AFE9-49F0-AEE8-C8A966195914}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Glimpse.Test.AspNet</RootNamespace>
<AssemblyName>Glimpse.Test.AspNet</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Moq">
<HintPath>..\..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="xunit, Version=1.9.1.1600, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\xunit.1.9.1\lib\net20\xunit.dll</HintPath>
</Reference>
<Reference Include="xunit.extensions">
<HintPath>..\..\packages\xunit.extensions.1.9.1\lib\net20\xunit.extensions.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AspNetFrameworkProviderShould.cs" />
<Compile Include="HttpApplicationStateBaseDataAdapterShould.cs" />
<Compile Include="HttpHandlerShould.cs" />
<Compile Include="HttpModuleShould.cs" />
<Compile Include="IResourceEndpointConfiguration.cs" />
<Compile Include="Model\RequestModelShould.cs" />
<Compile Include="Model\RouteInstanceShould.cs" />
<Compile Include="Model\RouteInstanceTester.cs" />
<Compile Include="Policy\LocalPolicyShould.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SerializationConverter\RequestModelConverterShould.cs" />
<Compile Include="Tab\RequestShould.cs" />
<Compile Include="Tab\RoutesShould.cs" />
<Compile Include="Tester\AspNetFrameworkProviderTester.cs" />
<Compile Include="Tester\HttpHandlerTester.cs" />
<Compile Include="Tester\HttpModuleTester.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Glimpse.AspNet\Glimpse.AspNet.csproj">
<Project>{FDDFC8A6-CDDF-4BC6-9F07-E76050E1EEE7}</Project>
<Name>Glimpse.AspNet</Name>
</ProjectReference>
<ProjectReference Include="..\Glimpse.Core\Glimpse.Core.csproj">
<Project>{C1289CE8-3259-41D9-893E-7A4E6F772D30}</Project>
<Name>Glimpse.Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Oops, something went wrong.

0 comments on commit 0303bc3

Please sign in to comment.