Skip to content
This repository was archived by the owner on Mar 19, 2019. It is now read-only.

Commit 0f69d63

Browse files
committed
#214 Use ConditionalFacts to skip tests on Mac and Linux at the assembly levely
1 parent 47fc364 commit 0f69d63

26 files changed

+274
-248
lines changed

test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/AuthenticationTests.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class AuthenticationTests
1818
private static bool AllowAnoymous = true;
1919
private static bool DenyAnoymous = false;
2020

21-
[Theory]
21+
[ConditionalTheory]
2222
[InlineData(AuthenticationSchemes.None)]
2323
[InlineData(AuthenticationSchemes.Negotiate)]
2424
[InlineData(AuthenticationSchemes.NTLM)]
@@ -113,7 +113,7 @@ public async Task MultipleAuthTypes_AllowAnonymousButSpecify401_ChallengesAdded(
113113
}
114114
}
115115

116-
[Theory]
116+
[ConditionalTheory]
117117
[InlineData(AuthenticationSchemes.Negotiate)]
118118
[InlineData(AuthenticationSchemes.NTLM)]
119119
// [InlineData(AuthenticationSchemes.Digest)] // TODO: Not implemented
@@ -149,7 +149,7 @@ public async Task AuthTypes_AllowAnonymousButSpecify401_Success(AuthenticationSc
149149
}
150150
}
151151

152-
[Theory]
152+
[ConditionalTheory]
153153
[InlineData(AuthenticationSchemes.Negotiate)]
154154
[InlineData(AuthenticationSchemes.NTLM)]
155155
// [InlineData(AuthenticationSchemes.Digest)] // TODO: Not implemented
@@ -171,7 +171,7 @@ public async Task AuthTypes_RequireAuth_Success(AuthenticationSchemes authType)
171171
}
172172
}
173173

174-
[Theory]
174+
[ConditionalTheory]
175175
[InlineData(AuthenticationSchemes.None)]
176176
[InlineData(AuthenticationSchemes.Negotiate)]
177177
[InlineData(AuthenticationSchemes.NTLM)]
@@ -204,7 +204,7 @@ public async Task AuthTypes_GetSingleDescriptions(AuthenticationSchemes authType
204204
}
205205
}
206206

207-
[Fact]
207+
[ConditionalFact]
208208
public async Task AuthTypes_GetMultipleDescriptions()
209209
{
210210
string address;
@@ -226,7 +226,7 @@ public async Task AuthTypes_GetMultipleDescriptions()
226226
}
227227
}
228228

229-
[Theory]
229+
[ConditionalTheory]
230230
[InlineData(AuthenticationSchemes.Negotiate)]
231231
[InlineData(AuthenticationSchemes.NTLM)]
232232
// [InlineData(AuthenticationSchemes.Digest)]
@@ -254,7 +254,7 @@ public async Task AuthTypes_AuthenticateWithNoUser_NoResults(AuthenticationSchem
254254
}
255255
}
256256

257-
[Theory]
257+
[ConditionalTheory]
258258
[InlineData(AuthenticationSchemes.Negotiate)]
259259
[InlineData(AuthenticationSchemes.NTLM)]
260260
// [InlineData(AuthenticationSchemes.Digest)]
@@ -364,7 +364,7 @@ public async Task AuthTypes_ChallengeOneAuthType_OneChallengeSent(Authentication
364364
}
365365
}
366366

367-
[Theory]
367+
[ConditionalTheory]
368368
[InlineData(AuthenticationSchemes.Negotiate)]
369369
[InlineData(AuthenticationSchemes.NTLM)]
370370
// [InlineData(AuthenticationSchemes.Digest)]
@@ -389,7 +389,7 @@ public async Task AuthTypes_ChallengeDisabledAuthType_Error(AuthenticationScheme
389389
}
390390
}
391391

392-
[Theory]
392+
[ConditionalTheory]
393393
[InlineData(AuthenticationSchemes.Negotiate)]
394394
[InlineData(AuthenticationSchemes.NTLM)]
395395
// [InlineData(AuthenticationSchemes.Digest)]
@@ -412,7 +412,7 @@ public async Task AuthTypes_Forbid_Forbidden(AuthenticationSchemes authType)
412412
}
413413
}
414414

415-
[Theory]
415+
[ConditionalTheory]
416416
[InlineData(AuthenticationSchemes.Negotiate)]
417417
[InlineData(AuthenticationSchemes.NTLM)]
418418
// [InlineData(AuthenticationSchemes.Digest)] // Not implemented
@@ -435,7 +435,7 @@ public async Task AuthTypes_ChallengeAuthenticatedAuthType_Forbidden(Authenticat
435435
}
436436
}
437437

438-
[Theory]
438+
[ConditionalTheory]
439439
[InlineData(AuthenticationSchemes.Negotiate)]
440440
[InlineData(AuthenticationSchemes.NTLM)]
441441
// [InlineData(AuthenticationSchemes.Digest)] // Not implemented
@@ -458,7 +458,7 @@ public async Task AuthTypes_ChallengeAuthenticatedAuthTypeWithEmptyChallenge_For
458458
}
459459
}
460460

461-
[Theory]
461+
[ConditionalTheory]
462462
[InlineData(AuthenticationSchemes.Negotiate)]
463463
[InlineData(AuthenticationSchemes.NTLM)]
464464
// [InlineData(AuthenticationSchemes.Digest)] // Not implemented

test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/HttpsTests.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Threading;
99
using System.Threading.Tasks;
1010
using Microsoft.AspNetCore.Http.Features;
11+
using Microsoft.AspNetCore.Testing.xunit;
1112
using Xunit;
1213

1314
namespace Microsoft.AspNetCore.Server.WebListener
@@ -16,7 +17,7 @@ public class HttpsTests
1617
{
1718
private const string Address = "https://localhost:9090/";
1819

19-
[Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")]
20+
[ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")]
2021
public async Task Https_200OK_Success()
2122
{
2223
using (Utilities.CreateHttpsServer(httpContext =>
@@ -29,7 +30,7 @@ public async Task Https_200OK_Success()
2930
}
3031
}
3132

32-
[Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")]
33+
[ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")]
3334
public async Task Https_SendHelloWorld_Success()
3435
{
3536
using (Utilities.CreateHttpsServer(httpContext =>
@@ -44,7 +45,7 @@ public async Task Https_SendHelloWorld_Success()
4445
}
4546
}
4647

47-
[Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")]
48+
[ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")]
4849
public async Task Https_EchoHelloWorld_Success()
4950
{
5051
using (Utilities.CreateHttpsServer(httpContext =>
@@ -62,7 +63,7 @@ public async Task Https_EchoHelloWorld_Success()
6263
}
6364
}
6465

65-
[Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")]
66+
[ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")]
6667
public async Task Https_ClientCertNotSent_ClientCertNotPresent()
6768
{
6869
using (Utilities.CreateHttpsServer(async httpContext =>
@@ -79,7 +80,7 @@ public async Task Https_ClientCertNotSent_ClientCertNotPresent()
7980
}
8081
}
8182

82-
[Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")]
83+
[ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")]
8384
public async Task Https_ClientCertRequested_ClientCertPresent()
8485
{
8586
using (Utilities.CreateHttpsServer(async httpContext =>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using Microsoft.AspNetCore.Testing.xunit;
5+
6+
[assembly: OSSkipCondition(OperatingSystems.MacOSX)]
7+
[assembly: OSSkipCondition(OperatingSystems.Linux)]

test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestBodyTests.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
using System.Text;
1010
using System.Threading;
1111
using System.Threading.Tasks;
12+
using Microsoft.AspNetCore.Testing.xunit;
1213
using Xunit;
1314

1415
namespace Microsoft.AspNetCore.Server.WebListener
1516
{
1617
public class RequestBodyTests
1718
{
18-
[Fact]
19+
[ConditionalFact]
1920
public async Task RequestBody_ReadSync_Success()
2021
{
2122
string address;
@@ -33,7 +34,7 @@ public async Task RequestBody_ReadSync_Success()
3334
}
3435
}
3536

36-
[Fact]
37+
[ConditionalFact]
3738
public async Task RequestBody_ReadAync_Success()
3839
{
3940
string address;
@@ -50,7 +51,7 @@ public async Task RequestBody_ReadAync_Success()
5051
}
5152
}
5253
#if !NETCOREAPP1_0
53-
[Fact]
54+
[ConditionalFact]
5455
public async Task RequestBody_ReadBeginEnd_Success()
5556
{
5657
string address;
@@ -69,7 +70,7 @@ public async Task RequestBody_ReadBeginEnd_Success()
6970
}
7071
#endif
7172

72-
[Fact]
73+
[ConditionalFact]
7374
public async Task RequestBody_InvalidBuffer_ArgumentException()
7475
{
7576
string address;
@@ -91,7 +92,7 @@ public async Task RequestBody_InvalidBuffer_ArgumentException()
9192
}
9293
}
9394

94-
[Fact]
95+
[ConditionalFact]
9596
public async Task RequestBody_ReadSyncPartialBody_Success()
9697
{
9798
StaggardContent content = new StaggardContent();
@@ -112,7 +113,7 @@ public async Task RequestBody_ReadSyncPartialBody_Success()
112113
}
113114
}
114115

115-
[Fact]
116+
[ConditionalFact]
116117
public async Task RequestBody_ReadAsyncPartialBody_Success()
117118
{
118119
StaggardContent content = new StaggardContent();
@@ -132,7 +133,7 @@ public async Task RequestBody_ReadAsyncPartialBody_Success()
132133
}
133134
}
134135

135-
[Fact]
136+
[ConditionalFact]
136137
public async Task RequestBody_PostWithImidateBody_Success()
137138
{
138139
string address;

test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestHeaderTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
using System.Net.Sockets;
77
using System.Text;
88
using System.Threading.Tasks;
9+
using Microsoft.AspNetCore.Testing.xunit;
910
using Microsoft.Extensions.Primitives;
1011
using Xunit;
1112

1213
namespace Microsoft.AspNetCore.Server.WebListener
1314
{
1415
public class RequestHeaderTests
1516
{
16-
[Fact]
17+
[ConditionalFact]
1718
public async Task RequestHeaders_ClientSendsDefaultHeaders_Success()
1819
{
1920
string address;
@@ -33,7 +34,7 @@ public async Task RequestHeaders_ClientSendsDefaultHeaders_Success()
3334
}
3435
}
3536

36-
[Fact]
37+
[ConditionalFact]
3738
public async Task RequestHeaders_ClientSendsCustomHeaders_Success()
3839
{
3940
string address;

test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestTests.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Microsoft.AspNetCore.Hosting.Server;
1212
using Microsoft.AspNetCore.Http;
1313
using Microsoft.AspNetCore.Http.Features;
14+
using Microsoft.AspNetCore.Testing.xunit;
1415
using Microsoft.Extensions.Logging;
1516
using Microsoft.Extensions.Options;
1617
using Microsoft.Net.Http.Server;
@@ -20,7 +21,7 @@ namespace Microsoft.AspNetCore.Server.WebListener
2021
{
2122
public class RequestTests
2223
{
23-
[Fact]
24+
[ConditionalFact]
2425
public async Task Request_SimpleGet_ExpectedFieldsSet()
2526
{
2627
string root;
@@ -68,7 +69,7 @@ public async Task Request_SimpleGet_ExpectedFieldsSet()
6869
}
6970
}
7071

71-
[Fact]
72+
[ConditionalFact]
7273
public async Task Request_FieldsCanBeSet_Set()
7374
{
7475
string root;
@@ -132,7 +133,7 @@ public async Task Request_FieldsCanBeSet_Set()
132133
}
133134
}
134135

135-
[Fact]
136+
[ConditionalFact]
136137
public async Task Request_FieldsCanBeSetToNull_Set()
137138
{
138139
string root;
@@ -195,7 +196,7 @@ public async Task Request_FieldsCanBeSetToNull_Set()
195196
}
196197
}
197198

198-
[Theory]
199+
[ConditionalTheory]
199200
[InlineData("/", "/", "", "/")]
200201
[InlineData("/basepath/", "/basepath", "/basepath", "")]
201202
[InlineData("/basepath/", "/basepath/", "/basepath", "/")]
@@ -238,7 +239,7 @@ public async Task Request_PathSplitting(string pathBase, string requestPath, str
238239
}
239240
}
240241

241-
[Fact]
242+
[ConditionalFact]
242243
public async Task Request_DoubleEscapingAllowed()
243244
{
244245
string root;
@@ -256,7 +257,7 @@ public async Task Request_DoubleEscapingAllowed()
256257
}
257258
}
258259

259-
[Theory]
260+
[ConditionalTheory]
260261
// The test server defines these prefixes: "/", "/11", "/2/3", "/2", "/11/2"
261262
[InlineData("/", "", "/")]
262263
[InlineData("/random", "", "/random")]

0 commit comments

Comments
 (0)