Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 62f2005

Browse files
committed
Merge pull request #2405 from davidsh/winhttpHandler_refactor_tests
Refactor WinHttpHandler tests for multiple test projects
2 parents 963be98 + 42d81c4 commit 62f2005

23 files changed

+2071
-33
lines changed

src/System.Net.Http.WinHttpHandler/System.Net.Http.WinHttpHandler.sln

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ VisualStudioVersion = 14.0.22816.0
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{BB2D2F6C-0445-43D4-84A9-DF5B4931FA19}") = "System.Net.Http.WinHttpHandler", "src\System.Net.Http.WinHttpHandler.csproj", "{F75E3008-0562-42DF-BE72-C1384F12157E}"
66
EndProject
7-
Project("{BB2D2F6C-0445-43D4-84A9-DF5B4931FA19}") = "System.Net.Http.WinHttpHandler.Tests", "tests\System.Net.Http.WinHttpHandler.Tests.csproj", "{A2ECDEDB-12B7-402C-9230-152B7601179F}"
7+
Project("{BB2D2F6C-0445-43D4-84A9-DF5B4931FA19}") = "System.Net.Http.WinHttpHandler.Unit.Tests", "tests\UnitTests\System.Net.Http.WinHttpHandler.Unit.Tests.csproj", "{A2ECDEDB-12B7-402C-9230-152B7601179F}"
88
EndProject
9+
Project("{BB2D2F6C-0445-43D4-84A9-DF5B4931FA19}") = "System.Net.Http.WinHttpHandler.Tests", "tests\FunctionalTests\System.Net.Http.WinHttpHandler.Tests.csproj", "{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}"
10+
EndProject
11+
912
Global
1013
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1114
FreeBSD_Debug|Any CPU = FreeBSD_Debug|Any CPU
@@ -50,6 +53,22 @@ Global
5053
{A2ECDEDB-12B7-402C-9230-152B7601179F}.Windows_Debug|Any CPU.Build.0 = Windows_Debug|Any CPU
5154
{A2ECDEDB-12B7-402C-9230-152B7601179F}.Windows_Release|Any CPU.ActiveCfg = Windows_Release|Any CPU
5255
{A2ECDEDB-12B7-402C-9230-152B7601179F}.Windows_Release|Any CPU.Build.0 = Windows_Release|Any CPU
56+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.FreeBSD_Debug|Any CPU.ActiveCfg = FreeBSD_Debug|Any CPU
57+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.FreeBSD_Debug|Any CPU.Build.0 = FreeBSD_Debug|Any CPU
58+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.FreeBSD_Release|Any CPU.ActiveCfg = FreeBSD_Release|Any CPU
59+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.FreeBSD_Release|Any CPU.Build.0 = FreeBSD_Release|Any CPU
60+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.Linux_Debug|Any CPU.ActiveCfg = Linux_Debug|Any CPU
61+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.Linux_Debug|Any CPU.Build.0 = Linux_Debug|Any CPU
62+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.Linux_Release|Any CPU.ActiveCfg = Linux_Release|Any CPU
63+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.Linux_Release|Any CPU.Build.0 = Linux_Release|Any CPU
64+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.OSX_Debug|Any CPU.ActiveCfg = OSX_Debug|Any CPU
65+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.OSX_Debug|Any CPU.Build.0 = OSX_Debug|Any CPU
66+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.OSX_Release|Any CPU.ActiveCfg = OSX_Release|Any CPU
67+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.OSX_Release|Any CPU.Build.0 = OSX_Release|Any CPU
68+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.Windows_Debug|Any CPU.ActiveCfg = Windows_Debug|Any CPU
69+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.Windows_Debug|Any CPU.Build.0 = Windows_Debug|Any CPU
70+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.Windows_Release|Any CPU.ActiveCfg = Windows_Release|Any CPU
71+
{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}.Windows_Release|Any CPU.Build.0 = Windows_Release|Any CPU
5372
EndGlobalSection
5473
GlobalSection(SolutionProperties) = preSolution
5574
HideSolutionNode = FALSE
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Windows_Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<RootNamespace>System.Net.Http.WinHttpHandler.Tests</RootNamespace>
10+
<AssemblyName>System.Net.Http.WinHttpHandler.Tests</AssemblyName>
11+
<UnsupportedPlatforms>Linux;OSX;FreeBSD</UnsupportedPlatforms>
12+
</PropertyGroup>
13+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'FreeBSD_Debug|AnyCPU' " />
14+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'FreeBSD_Release|AnyCPU' " />
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Linux_Debug|AnyCPU' " />
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Linux_Release|AnyCPU' " />
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'OSX_Debug|AnyCPU' " />
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'OSX_Release|AnyCPU' " />
19+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Windows_Debug|AnyCPU' " />
20+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Windows_Release|AnyCPU' " />
21+
22+
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' ">
23+
<Compile Include="$(CommonTestPath)\System\Net\HttpTestServers.cs">
24+
<Link>Common\System\Net\HttpTestServers.cs</Link>
25+
</Compile>
26+
27+
<Compile Include="WinHttpHandlerTest.cs" />
28+
<Compile Include="XunitTestAssemblyAtrributes.cs" />
29+
</ItemGroup>
30+
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' ">
31+
<ProjectReference Include="..\..\src\System.Net.Http.WinHttpHandler.csproj">
32+
<Project>{F75E3008-0562-42DF-BE72-C1384F12157E}</Project>
33+
<Name>System.Net.Http.WinHttpHandler</Name>
34+
</ProjectReference>
35+
</ItemGroup> <ItemGroup>
36+
<None Include="project.json" />
37+
</ItemGroup>
38+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
39+
</Project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using System;
5+
using System.Net;
6+
using System.Net.Http;
7+
using System.Net.Tests;
8+
9+
using Xunit;
10+
using Xunit.Abstractions;
11+
12+
namespace System.Net.Http.WinHttpHandlerTests
13+
{
14+
public class WinHttpHandlerTest
15+
{
16+
readonly ITestOutputHelper _output;
17+
18+
public WinHttpHandlerTest(ITestOutputHelper output)
19+
{
20+
_output = output;
21+
}
22+
23+
[Fact]
24+
public void SendAsync_SimpleGet_Success()
25+
{
26+
var handler = new WinHttpHandler();
27+
var client = new HttpClient(handler);
28+
29+
// TODO: This is a placeholder until GitHub Issue #2383 gets resolved.
30+
var response = client.GetAsync(HttpTestServers.RemoteGetServer).Result;
31+
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
32+
var responseContent = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
33+
_output.WriteLine(responseContent);
34+
}
35+
}
36+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"dependencies": {
3+
"Microsoft.Win32.Primitives": "4.0.0-*",
4+
"System.Globalization": "4.0.10-*",
5+
"System.IO": "4.0.10-*",
6+
"System.IO.Compression": "4.0.0-*",
7+
"System.Net.Http": "4.0.0-*",
8+
"System.Net.Primitives": "4.0.10-*",
9+
"System.Resources.ResourceManager": "4.0.0-*",
10+
"System.Runtime.Extensions": "4.0.10-*",
11+
"System.Runtime.Handles": "4.0.0-*",
12+
"System.Runtime.InteropServices": "4.0.20-*",
13+
"System.Security.Cryptography.X509Certificates": "4.0.0-*",
14+
"System.Security.Principal": "4.0.0-*",
15+
"System.Text.Encoding": "4.0.10-*",
16+
"System.Threading": "4.0.0-*",
17+
"System.Threading.Tasks": "4.0.0-*",
18+
"System.Threading.Thread": "4.0.0-*",
19+
"xunit": "2.0.0-beta5-build2785",
20+
"xunit.abstractions.netcore": "1.0.0-prerelease",
21+
"xunit.assert": "2.0.0-beta5-build2785",
22+
"xunit.core.netcore": "1.0.1-prerelease",
23+
"xunit.netcore.extensions": "1.0.0-prerelease-*"
24+
},
25+
"frameworks": {
26+
"dnxcore50": {}
27+
}
28+
}

0 commit comments

Comments
 (0)