From 0f69d6351d2a270d68a30080a722110cb48c08fd Mon Sep 17 00:00:00 2001 From: Chris R Date: Fri, 7 Oct 2016 15:35:09 -0700 Subject: [PATCH] #214 Use ConditionalFacts to skip tests on Mac and Linux at the assembly levely --- .../AuthenticationTests.cs | 24 +++---- .../HttpsTests.cs | 11 ++-- .../Properties/AssemblyInfo.cs | 7 ++ .../RequestBodyTests.cs | 15 +++-- .../RequestHeaderTests.cs | 5 +- .../RequestTests.cs | 13 ++-- .../ResponseBodyTests.cs | 23 +++---- .../ResponseCachingTests.cs | 21 +++--- .../ResponseHeaderTests.cs | 19 +++--- .../ResponseSendFileTests.cs | 29 +++++---- .../ResponseTests.cs | 19 +++--- .../ServerTests.cs | 21 +++--- .../WebSocketTests.cs | 6 +- .../AuthenticationTests.cs | 6 +- .../HttpsTests.cs | 11 ++-- .../Properties/AssemblyInfo.cs | 7 ++ .../RequestBodyTests.cs | 27 ++++---- .../RequestHeaderTests.cs | 7 +- .../RequestTests.cs | 19 +++--- .../ResponseBodyTests.cs | 47 +++++++------- .../ResponseCachingTests.cs | 64 +++++++++---------- .../ResponseHeaderTests.cs | 35 +++++----- .../ResponseSendFileTests.cs | 47 +++++++------- .../ResponseTests.cs | 13 ++-- .../ServerTests.cs | 22 +++---- .../WebSocketTests.cs | 4 +- 26 files changed, 274 insertions(+), 248 deletions(-) create mode 100644 test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/Properties/AssemblyInfo.cs create mode 100644 test/Microsoft.Net.Http.Server.FunctionalTests/Properties/AssemblyInfo.cs diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/AuthenticationTests.cs b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/AuthenticationTests.cs index 4fda684f19..b9dedca1bb 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/AuthenticationTests.cs +++ b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/AuthenticationTests.cs @@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Server.WebListener private static bool AllowAnoymous = true; private static bool DenyAnoymous = false; - [Theory] + [ConditionalTheory] [InlineData(AuthenticationSchemes.None)] [InlineData(AuthenticationSchemes.Negotiate)] [InlineData(AuthenticationSchemes.NTLM)] @@ -113,7 +113,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Theory] + [ConditionalTheory] [InlineData(AuthenticationSchemes.Negotiate)] [InlineData(AuthenticationSchemes.NTLM)] // [InlineData(AuthenticationSchemes.Digest)] // TODO: Not implemented @@ -149,7 +149,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Theory] + [ConditionalTheory] [InlineData(AuthenticationSchemes.Negotiate)] [InlineData(AuthenticationSchemes.NTLM)] // [InlineData(AuthenticationSchemes.Digest)] // TODO: Not implemented @@ -171,7 +171,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Theory] + [ConditionalTheory] [InlineData(AuthenticationSchemes.None)] [InlineData(AuthenticationSchemes.Negotiate)] [InlineData(AuthenticationSchemes.NTLM)] @@ -204,7 +204,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task AuthTypes_GetMultipleDescriptions() { string address; @@ -226,7 +226,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Theory] + [ConditionalTheory] [InlineData(AuthenticationSchemes.Negotiate)] [InlineData(AuthenticationSchemes.NTLM)] // [InlineData(AuthenticationSchemes.Digest)] @@ -254,7 +254,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Theory] + [ConditionalTheory] [InlineData(AuthenticationSchemes.Negotiate)] [InlineData(AuthenticationSchemes.NTLM)] // [InlineData(AuthenticationSchemes.Digest)] @@ -364,7 +364,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Theory] + [ConditionalTheory] [InlineData(AuthenticationSchemes.Negotiate)] [InlineData(AuthenticationSchemes.NTLM)] // [InlineData(AuthenticationSchemes.Digest)] @@ -389,7 +389,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Theory] + [ConditionalTheory] [InlineData(AuthenticationSchemes.Negotiate)] [InlineData(AuthenticationSchemes.NTLM)] // [InlineData(AuthenticationSchemes.Digest)] @@ -412,7 +412,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Theory] + [ConditionalTheory] [InlineData(AuthenticationSchemes.Negotiate)] [InlineData(AuthenticationSchemes.NTLM)] // [InlineData(AuthenticationSchemes.Digest)] // Not implemented @@ -435,7 +435,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Theory] + [ConditionalTheory] [InlineData(AuthenticationSchemes.Negotiate)] [InlineData(AuthenticationSchemes.NTLM)] // [InlineData(AuthenticationSchemes.Digest)] // Not implemented @@ -458,7 +458,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Theory] + [ConditionalTheory] [InlineData(AuthenticationSchemes.Negotiate)] [InlineData(AuthenticationSchemes.NTLM)] // [InlineData(AuthenticationSchemes.Digest)] // Not implemented diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/HttpsTests.cs b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/HttpsTests.cs index 3ea7b496ba..2309b9cf7d 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/HttpsTests.cs +++ b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/HttpsTests.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Testing.xunit; using Xunit; namespace Microsoft.AspNetCore.Server.WebListener @@ -16,7 +17,7 @@ namespace Microsoft.AspNetCore.Server.WebListener { private const string Address = "https://localhost:9090/"; - [Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] + [ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] public async Task Https_200OK_Success() { using (Utilities.CreateHttpsServer(httpContext => @@ -29,7 +30,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] + [ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] public async Task Https_SendHelloWorld_Success() { using (Utilities.CreateHttpsServer(httpContext => @@ -44,7 +45,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] + [ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] public async Task Https_EchoHelloWorld_Success() { using (Utilities.CreateHttpsServer(httpContext => @@ -62,7 +63,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] + [ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] public async Task Https_ClientCertNotSent_ClientCertNotPresent() { using (Utilities.CreateHttpsServer(async httpContext => @@ -79,7 +80,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] + [ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] public async Task Https_ClientCertRequested_ClientCertPresent() { using (Utilities.CreateHttpsServer(async httpContext => diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/Properties/AssemblyInfo.cs b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..6d9ec40e96 --- /dev/null +++ b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/Properties/AssemblyInfo.cs @@ -0,0 +1,7 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Testing.xunit; + +[assembly: OSSkipCondition(OperatingSystems.MacOSX)] +[assembly: OSSkipCondition(OperatingSystems.Linux)] \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestBodyTests.cs b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestBodyTests.cs index ba4ea1d02d..6214e65d72 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestBodyTests.cs +++ b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestBodyTests.cs @@ -9,13 +9,14 @@ using System.Net.Sockets; using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing.xunit; using Xunit; namespace Microsoft.AspNetCore.Server.WebListener { public class RequestBodyTests { - [Fact] + [ConditionalFact] public async Task RequestBody_ReadSync_Success() { string address; @@ -33,7 +34,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task RequestBody_ReadAync_Success() { string address; @@ -50,7 +51,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } #if !NETCOREAPP1_0 - [Fact] + [ConditionalFact] public async Task RequestBody_ReadBeginEnd_Success() { string address; @@ -69,7 +70,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } #endif - [Fact] + [ConditionalFact] public async Task RequestBody_InvalidBuffer_ArgumentException() { string address; @@ -91,7 +92,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task RequestBody_ReadSyncPartialBody_Success() { StaggardContent content = new StaggardContent(); @@ -112,7 +113,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task RequestBody_ReadAsyncPartialBody_Success() { StaggardContent content = new StaggardContent(); @@ -132,7 +133,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task RequestBody_PostWithImidateBody_Success() { string address; diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestHeaderTests.cs b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestHeaderTests.cs index ddcf183170..196de8dad6 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestHeaderTests.cs +++ b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestHeaderTests.cs @@ -6,6 +6,7 @@ using System.Net.Http; using System.Net.Sockets; using System.Text; using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Primitives; using Xunit; @@ -13,7 +14,7 @@ namespace Microsoft.AspNetCore.Server.WebListener { public class RequestHeaderTests { - [Fact] + [ConditionalFact] public async Task RequestHeaders_ClientSendsDefaultHeaders_Success() { string address; @@ -33,7 +34,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task RequestHeaders_ClientSendsCustomHeaders_Success() { string address; diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestTests.cs b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestTests.cs index e9a4714c1d..4e75ac0e0a 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestTests.cs +++ b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/RequestTests.cs @@ -11,6 +11,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting.Server; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Microsoft.Net.Http.Server; @@ -20,7 +21,7 @@ namespace Microsoft.AspNetCore.Server.WebListener { public class RequestTests { - [Fact] + [ConditionalFact] public async Task Request_SimpleGet_ExpectedFieldsSet() { string root; @@ -68,7 +69,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Request_FieldsCanBeSet_Set() { string root; @@ -132,7 +133,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Request_FieldsCanBeSetToNull_Set() { string root; @@ -195,7 +196,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Theory] + [ConditionalTheory] [InlineData("/", "/", "", "/")] [InlineData("/basepath/", "/basepath", "/basepath", "")] [InlineData("/basepath/", "/basepath/", "/basepath", "/")] @@ -238,7 +239,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Request_DoubleEscapingAllowed() { string root; @@ -256,7 +257,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Theory] + [ConditionalTheory] // The test server defines these prefixes: "/", "/11", "/2/3", "/2", "/11/2" [InlineData("/", "", "/")] [InlineData("/random", "", "/random")] diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseBodyTests.cs b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseBodyTests.cs index f7eee58eeb..6842146dd1 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseBodyTests.cs +++ b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseBodyTests.cs @@ -9,13 +9,14 @@ using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing.xunit; using Xunit; namespace Microsoft.AspNetCore.Server.WebListener { public class ResponseBodyTests { - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteNoHeaders_SetsChunked() { string address; @@ -35,7 +36,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteNoHeadersAndFlush_DefaultsToChunked() { string address; @@ -56,7 +57,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteChunked_ManuallyChunked() { string address; @@ -78,7 +79,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteContentLength_PassedThrough() { string address; @@ -106,7 +107,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteContentLengthNoneWritten_Throws() { string address; @@ -120,7 +121,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public void ResponseBody_WriteContentLengthNotEnoughWritten_Throws() { string address; @@ -135,7 +136,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteContentLengthTooMuchWritten_Throws() { var completed = false; @@ -154,7 +155,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteContentLengthExtraWritten_Throws() { var waitHandle = new ManualResetEvent(false); @@ -193,7 +194,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseBody_Write_TriggersOnStarting() { var onStartingCalled = false; @@ -221,7 +222,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } #if NET451 - [Fact] + [ConditionalFact] public async Task ResponseBody_BeginWrite_TriggersOnStarting() { var onStartingCalled = false; @@ -249,7 +250,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } #endif - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteAsync_TriggersOnStarting() { var onStartingCalled = false; diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseCachingTests.cs b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseCachingTests.cs index b8d841bb92..0f0c702d25 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseCachingTests.cs +++ b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseCachingTests.cs @@ -5,13 +5,14 @@ using System; using System.Linq; using System.Net.Http; using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing.xunit; using Xunit; namespace Microsoft.AspNetCore.Server.WebListener.FunctionalTests { public class ResponseCachingTests { - [Fact] + [ConditionalFact] public async Task Caching_NoCacheControl_NotCached() { var requestCount = 1; @@ -29,7 +30,7 @@ namespace Microsoft.AspNetCore.Server.WebListener.FunctionalTests } } - [Fact] + [ConditionalFact] public async Task Caching_JustPublic_NotCached() { var requestCount = 1; @@ -48,7 +49,7 @@ namespace Microsoft.AspNetCore.Server.WebListener.FunctionalTests } } - [Fact] + [ConditionalFact] public async Task Caching_MaxAge_Cached() { var requestCount = 1; @@ -67,7 +68,7 @@ namespace Microsoft.AspNetCore.Server.WebListener.FunctionalTests } } - [Fact] + [ConditionalFact] public async Task Caching_SMaxAge_Cached() { var requestCount = 1; @@ -86,7 +87,7 @@ namespace Microsoft.AspNetCore.Server.WebListener.FunctionalTests } } - [Fact] + [ConditionalFact] public async Task Caching_SMaxAgeAndMaxAge_SMaxAgePreferredCached() { var requestCount = 1; @@ -105,7 +106,7 @@ namespace Microsoft.AspNetCore.Server.WebListener.FunctionalTests } } - [Fact] + [ConditionalFact] public async Task Caching_Expires_Cached() { var requestCount = 1; @@ -125,7 +126,7 @@ namespace Microsoft.AspNetCore.Server.WebListener.FunctionalTests } } - [Theory] + [ConditionalTheory] [InlineData("Set-cookie")] [InlineData("vary")] [InlineData("pragma")] @@ -148,7 +149,7 @@ namespace Microsoft.AspNetCore.Server.WebListener.FunctionalTests } } - [Theory] + [ConditionalTheory] [InlineData("0")] [InlineData("-1")] public async Task Caching_InvalidExpires_NotCached(string expiresValue) @@ -170,7 +171,7 @@ namespace Microsoft.AspNetCore.Server.WebListener.FunctionalTests } } - [Fact] + [ConditionalFact] public async Task Caching_ExpiresWithoutPublic_NotCached() { var requestCount = 1; @@ -189,7 +190,7 @@ namespace Microsoft.AspNetCore.Server.WebListener.FunctionalTests } } - [Fact] + [ConditionalFact] public async Task Caching_MaxAgeAndExpires_MaxAgePreferred() { var requestCount = 1; diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseHeaderTests.cs b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseHeaderTests.cs index 8183b52aed..d5fc13c3a6 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseHeaderTests.cs +++ b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseHeaderTests.cs @@ -9,6 +9,7 @@ using System.Net.Http; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Primitives; using Xunit; @@ -16,7 +17,7 @@ namespace Microsoft.AspNetCore.Server.WebListener { public class ResponseHeaderTests { - [Fact] + [ConditionalFact] public async Task ResponseHeaders_ServerSendsDefaultHeaders_Success() { string address; @@ -36,7 +37,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_ServerSendsSingleValueKnownHeaders_Success() { string address; @@ -60,7 +61,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_ServerSendsMultiValueKnownHeaders_Success() { string address; @@ -88,7 +89,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_ServerSendsCustomHeaders_Success() { string address; @@ -116,7 +117,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_ServerSendsConnectionClose_Closed() { string address; @@ -141,7 +142,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_HTTP10Request_Gets11Close() { string address; @@ -164,7 +165,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_HTTP10RequestWithChunkedHeader_ManualChunking() { string address; @@ -193,7 +194,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Headers_FlushSendsHeaders_Success() { string address; @@ -224,7 +225,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Headers_FlushAsyncSendsHeaders_Success() { string address; diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseSendFileTests.cs b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseSendFileTests.cs index ce22eb6074..4ee3342188 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseSendFileTests.cs +++ b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseSendFileTests.cs @@ -11,6 +11,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Testing.xunit; using Xunit; namespace Microsoft.AspNetCore.Server.WebListener @@ -28,7 +29,7 @@ namespace Microsoft.AspNetCore.Server.WebListener FileLength = new FileInfo(AbsoluteFilePath).Length; } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_SupportKeys_Present() { string address; @@ -69,7 +70,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_MissingFile_Throws() { var waitHandle = new ManualResetEvent(false); @@ -103,7 +104,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_NoHeaders_DefaultsToChunked() { string address; @@ -122,7 +123,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_RelativeFile_Success() { string address; @@ -141,7 +142,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_Unspecified_Chunked() { string address; @@ -160,7 +161,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_MultipleWrites_Chunked() { string address; @@ -180,7 +181,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_HalfOfFile_Chunked() { string address; @@ -199,7 +200,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_OffsetOutOfRange_Throws() { var completed = false; @@ -218,7 +219,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_CountOutOfRange_Throws() { var completed = false; @@ -237,7 +238,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_Count0_Chunked() { string address; @@ -256,7 +257,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_ContentLength_PassedThrough() { string address; @@ -277,7 +278,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_ContentLengthSpecific_PassedThrough() { string address; @@ -298,7 +299,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_ContentLength0_PassedThrough() { string address; @@ -319,7 +320,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_TriggersOnStarting() { var onStartingCalled = false; diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseTests.cs b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseTests.cs index ba02e65bb0..950e80aca3 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseTests.cs +++ b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ResponseTests.cs @@ -8,13 +8,14 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Testing.xunit; using Xunit; namespace Microsoft.AspNetCore.Server.WebListener { public class ResponseTests { - [Fact] + [ConditionalFact] public async Task Response_ServerSendsDefaultResponse_ServerProvidesStatusCodeAndReasonPhrase() { string address; @@ -33,7 +34,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Response_ServerSendsSpecificStatus_ServerProvidesReasonPhrase() { string address; @@ -52,7 +53,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Response_ServerSendsSpecificStatusAndReasonPhrase_PassedThrough() { string address; @@ -72,7 +73,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Response_ServerSendsCustomStatus_NoReasonPhrase() { string address; @@ -89,7 +90,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Response_StatusCode100_Throws() { string address; @@ -104,7 +105,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Response_StatusCode0_Throws() { string address; @@ -119,7 +120,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Response_Empty_CallsOnStartingAndOnCompleted() { var onStartingCalled = new ManualResetEvent(false); @@ -150,7 +151,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Response_OnStartingThrows_StillCallsOnCompleted() { var onStartingCalled = new ManualResetEvent(false); @@ -180,7 +181,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Response_OnStartingThrowsAfterWrite_WriteThrowsAndStillCallsOnCompleted() { var onStartingCalled = new ManualResetEvent(false); diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ServerTests.cs b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ServerTests.cs index 2278c18bbe..d84295a7b3 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ServerTests.cs +++ b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/ServerTests.cs @@ -12,6 +12,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Microsoft.Net.Http.Server; @@ -21,7 +22,7 @@ namespace Microsoft.AspNetCore.Server.WebListener { public class ServerTests { - [Fact] + [ConditionalFact] public async Task Server_200OK_Success() { string address; @@ -35,7 +36,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Server_SendHelloWorld_Success() { string address; @@ -50,7 +51,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Server_EchoHelloWorld_Success() { string address; @@ -67,7 +68,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Server_ShutdownDurringRequest_Success() { Task responseTask; @@ -87,7 +88,7 @@ namespace Microsoft.AspNetCore.Server.WebListener Assert.Equal("Hello World", response); } - [Fact] + [ConditionalFact] public void Server_AppException_ClientReset() { string address; @@ -105,7 +106,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public void Server_MultipleOutstandingSyncRequests_Success() { int requestLimit = 10; @@ -138,7 +139,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public void Server_MultipleOutstandingAsyncRequests_Success() { int requestLimit = 10; @@ -168,7 +169,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Server_ClientDisconnects_CallCanceled() { TimeSpan interval = TimeSpan.FromSeconds(1); @@ -204,7 +205,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Server_Abort_CallCanceled() { TimeSpan interval = TimeSpan.FromSeconds(100); @@ -234,7 +235,7 @@ namespace Microsoft.AspNetCore.Server.WebListener } } - [Fact] + [ConditionalFact] public async Task Server_SetQueueLimit_Success() { // This is just to get a dynamic port diff --git a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/WebSocketTests.cs b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/WebSocketTests.cs index df28ef5258..5d3c28c736 100644 --- a/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/WebSocketTests.cs +++ b/test/Microsoft.AspNetCore.Server.WebListener.FunctionalTests/WebSocketTests.cs @@ -13,10 +13,10 @@ using Xunit; namespace Microsoft.AspNetCore.Server.WebListener { + [OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)] public class WebSocketTests { [ConditionalFact] - [OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)] public async Task WebSocketTests_SupportKeys_Present() { string address; @@ -43,7 +43,6 @@ namespace Microsoft.AspNetCore.Server.WebListener } [ConditionalFact] - [OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)] public async Task WebSocketTests_AfterHeadersSent_Throws() { bool? upgradeThrew = null; @@ -71,7 +70,6 @@ namespace Microsoft.AspNetCore.Server.WebListener } [ConditionalFact] - [OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)] public async Task WebSocketAccept_Success() { ManualResetEvent waitHandle = new ManualResetEvent(false); @@ -97,7 +95,6 @@ namespace Microsoft.AspNetCore.Server.WebListener } [ConditionalFact] - [OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)] public async Task WebSocketAccept_WithOnStarting_CallbackCalled() { var callbackCalled = false; @@ -130,7 +127,6 @@ namespace Microsoft.AspNetCore.Server.WebListener } [ConditionalFact] - [OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)] public async Task WebSocketAccept_SendAndReceive_Success() { byte[] clientBuffer = new byte[] { 0x00, 0x01, 0xFF, 0x00, 0x00 }; diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/AuthenticationTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/AuthenticationTests.cs index 54b9c6e72e..93b21417e8 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/AuthenticationTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/AuthenticationTests.cs @@ -15,7 +15,7 @@ namespace Microsoft.Net.Http.Server private static bool AllowAnoymous = true; private static bool DenyAnoymous = false; - [Theory] + [ConditionalTheory] [InlineData(AuthenticationSchemes.None)] [InlineData(AuthenticationSchemes.Negotiate)] [InlineData(AuthenticationSchemes.NTLM)] @@ -114,7 +114,7 @@ namespace Microsoft.Net.Http.Server } } - [Theory] + [ConditionalTheory] [InlineData(AuthenticationSchemes.Negotiate)] [InlineData(AuthenticationSchemes.NTLM)] // [InlineData(AuthenticationSchemes.Digest)] // TODO: Not implemented @@ -145,7 +145,7 @@ namespace Microsoft.Net.Http.Server } } - [Theory] + [ConditionalTheory] [InlineData(AuthenticationSchemes.Negotiate)] [InlineData(AuthenticationSchemes.NTLM)] // [InlineData(AuthenticationSchemes.Digest)] // TODO: Not implemented diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/HttpsTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/HttpsTests.cs index 85ed02b553..58bf36998c 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/HttpsTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/HttpsTests.cs @@ -6,6 +6,7 @@ using System.Net.Http; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing.xunit; using Xunit; namespace Microsoft.Net.Http.Server @@ -15,7 +16,7 @@ namespace Microsoft.Net.Http.Server // Note these tests can't use dynamic ports or run concurrently because the ssl cert must be pre-registered with a specific port. private const string Address = "https://localhost:9090/"; - [Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] + [ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] public async Task Https_200OK_Success() { using (var server = Utilities.CreateHttpsServer()) @@ -30,7 +31,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] + [ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] public async Task Https_SendHelloWorld_Success() { using (var server = Utilities.CreateHttpsServer()) @@ -48,7 +49,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] + [ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] public async Task Https_EchoHelloWorld_Success() { using (var server = Utilities.CreateHttpsServer()) @@ -69,7 +70,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] + [ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] public async Task Https_ClientCertNotSent_ClientCertNotPresent() { using (var server = Utilities.CreateHttpsServer()) @@ -86,7 +87,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] + [ConditionalFact(Skip = "TODO: Add trait filtering support so these SSL tests don't get run on teamcity or the command line."), Trait("scheme", "https")] public async Task Https_ClientCertRequested_ClientCertPresent() { using (var server = Utilities.CreateHttpsServer()) diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/Properties/AssemblyInfo.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..6d9ec40e96 --- /dev/null +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/Properties/AssemblyInfo.cs @@ -0,0 +1,7 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Testing.xunit; + +[assembly: OSSkipCondition(OperatingSystems.MacOSX)] +[assembly: OSSkipCondition(OperatingSystems.Linux)] \ No newline at end of file diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/RequestBodyTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/RequestBodyTests.cs index 7f2c2a4725..87b6d62dbf 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/RequestBodyTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/RequestBodyTests.cs @@ -9,13 +9,14 @@ using System.Net.Sockets; using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing.xunit; using Xunit; namespace Microsoft.Net.Http.Server { public class RequestBodyTests { - [Fact] + [ConditionalFact] public async Task RequestBody_ReadSync_Success() { string address; @@ -34,7 +35,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task RequestBody_ReadAync_Success() { string address; @@ -53,7 +54,7 @@ namespace Microsoft.Net.Http.Server } } #if NET451 - [Fact] + [ConditionalFact] public async Task RequestBody_ReadBeginEnd_Success() { string address; @@ -73,7 +74,7 @@ namespace Microsoft.Net.Http.Server } #endif - [Fact] + [ConditionalFact] public async Task RequestBody_InvalidBuffer_ArgumentException() { string address; @@ -97,7 +98,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task RequestBody_ReadSyncPartialBody_Success() { StaggardContent content = new StaggardContent(); @@ -120,7 +121,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task RequestBody_ReadAsyncPartialBody_Success() { StaggardContent content = new StaggardContent(); @@ -143,7 +144,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task RequestBody_PostWithImidateBody_Success() { string address; @@ -169,7 +170,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task RequestBody_ReadAsyncAlreadyCanceled_ReturnsCanceledTask() { string address; @@ -193,7 +194,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task RequestBody_ReadAsyncPartialBodyWithCancellationToken_Success() { StaggardContent content = new StaggardContent(); @@ -217,7 +218,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task RequestBody_ReadAsyncPartialBodyWithTimeout_Success() { StaggardContent content = new StaggardContent(); @@ -242,7 +243,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task RequestBody_ReadAsyncPartialBodyAndCancel_Canceled() { StaggardContent content = new StaggardContent(); @@ -267,7 +268,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task RequestBody_ReadAsyncPartialBodyAndExpiredTimeout_Canceled() { StaggardContent content = new StaggardContent(); @@ -294,7 +295,7 @@ namespace Microsoft.Net.Http.Server // Make sure that using our own disconnect token as a read cancellation token doesn't // cause recursion problems when it fires and calls Abort. - [Fact] + [ConditionalFact] public async Task RequestBody_ReadAsyncPartialBodyAndDisconnectedClient_Canceled() { StaggardContent content = new StaggardContent(); diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/RequestHeaderTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/RequestHeaderTests.cs index 97fe7a1b81..2511e80d28 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/RequestHeaderTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/RequestHeaderTests.cs @@ -6,6 +6,7 @@ using System.Net.Http; using System.Net.Sockets; using System.Text; using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Primitives; using Xunit; @@ -13,7 +14,7 @@ namespace Microsoft.Net.Http.Server { public class RequestHeaderTests { - [Fact] + [ConditionalFact] public async Task RequestHeaders_ClientSendsDefaultHeaders_Success() { string address; @@ -38,7 +39,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task RequestHeaders_ClientSendsCustomHeaders_Success() { string address; @@ -65,7 +66,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task RequestHeaders_ClientSendsUtf8Headers_Success() { string address; diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/RequestTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/RequestTests.cs index 058e8f2fcd..f86e9a1124 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/RequestTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/RequestTests.cs @@ -7,13 +7,14 @@ using System.Net.Http; using System.Net.Sockets; using System.Text; using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing.xunit; using Xunit; namespace Microsoft.Net.Http.Server { public class RequestTests { - [Fact] + [ConditionalFact] public async Task Request_SimpleGet_Success() { string root; @@ -50,7 +51,7 @@ namespace Microsoft.Net.Http.Server } } - [Theory] + [ConditionalTheory] [InlineData("/", "/", "", "/")] [InlineData("/basepath/", "/basepath", "/basepath", "")] [InlineData("/basepath/", "/basepath/", "/basepath", "/")] @@ -82,7 +83,7 @@ namespace Microsoft.Net.Http.Server } } - [Theory] + [ConditionalTheory] [InlineData("/path%")] [InlineData("/path%XY")] [InlineData("/path%F")] @@ -100,7 +101,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Request_DoubleEscapingAllowed() { string root; @@ -112,7 +113,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Request_OptionsStar_EmptyPath() { string root; @@ -127,7 +128,7 @@ namespace Microsoft.Net.Http.Server } } - [Theory] + [ConditionalTheory] // The test server defines these prefixes: "/", "/11", "/2/3", "/2", "/11/2" [InlineData("/", "", "/")] [InlineData("/random", "", "/random")] @@ -171,7 +172,7 @@ namespace Microsoft.Net.Http.Server } } - [Theory] + [ConditionalTheory] [InlineData("%D0%A4", "Ф")] [InlineData("%d0%a4", "Ф")] [InlineData("%E0%A4%AD", "भ")] @@ -212,7 +213,7 @@ namespace Microsoft.Net.Http.Server Assert.Equal(expect, actualPath.TrimStart('/')); } - [Theory] + [ConditionalTheory] [InlineData("/%%32")] [InlineData("/%%20")] [InlineData("/%F0%8F%8F%BF")] @@ -233,7 +234,7 @@ namespace Microsoft.Net.Http.Server } } - [Theory] + [ConditionalTheory] // Overlong ASCII [InlineData("/%C0%A4", "/%C0%A4")] [InlineData("/%C1%BF", "/%C1%BF")] diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseBodyTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseBodyTests.cs index 0c3efc5835..3f72bc88f6 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseBodyTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseBodyTests.cs @@ -9,13 +9,14 @@ using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing.xunit; using Xunit; namespace Microsoft.Net.Http.Server { public class ResponseBodyTests { - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteNoHeaders_DefaultsToChunked() { string address; @@ -38,7 +39,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_FlushThenWrite_DefaultsToChunkedAndTerminates() { string address; @@ -61,7 +62,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteChunked_ManuallyChunked() { string address; @@ -86,7 +87,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteContentLength_PassedThrough() { string address; @@ -117,7 +118,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteContentLengthNoneWritten_Aborts() { string address; @@ -138,7 +139,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteContentLengthNotEnoughWritten_Aborts() { string address; @@ -155,7 +156,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteContentLengthTooMuchWritten_Throws() { string address; @@ -173,7 +174,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteContentLengthExtraWritten_Throws() { string address; @@ -198,7 +199,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteZeroCount_StartsChunkedResponse() { string address; @@ -222,7 +223,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteAsyncWithActiveCancellationToken_Success() { string address; @@ -243,7 +244,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_WriteAsyncWithTimerCancellationToken_Success() { string address; @@ -265,7 +266,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBodyWriteExceptions_FirstWriteAsyncWithCanceledCancellationToken_CancelsAndAborts() { string address; @@ -295,7 +296,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_FirstWriteAsyncWithCanceledCancellationToken_CancelsAndAborts() { string address; @@ -324,7 +325,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBodyWriteExceptions_SecondWriteAsyncWithCanceledCancellationToken_CancelsAndAborts() { string address; @@ -346,7 +347,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_SecondWriteAsyncWithCanceledCancellationToken_CancelsAndAborts() { string address; @@ -367,7 +368,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBodyWriteExceptions_ClientDisconnectsBeforeFirstWrite_WriteThrows() { string address; @@ -397,7 +398,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBodyWriteExceptions_ClientDisconnectsBeforeFirstWriteAsync_WriteThrows() { string address; @@ -429,7 +430,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_ClientDisconnectsBeforeFirstWrite_WriteCompletesSilently() { string address; @@ -452,7 +453,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_ClientDisconnectsBeforeFirstWriteAsync_WriteCompletesSilently() { string address; @@ -475,7 +476,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBodyWriteExceptions_ClientDisconnectsBeforeSecondWrite_WriteThrows() { string address; @@ -509,7 +510,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBodyWriteExceptions_ClientDisconnectsBeforeSecondWriteAsync_WriteThrows() { string address; @@ -543,7 +544,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_ClientDisconnectsBeforeSecondWrite_WriteCompletesSilently() { string address; @@ -573,7 +574,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseBody_ClientDisconnectsBeforeSecondWriteAsync_WriteCompletesSilently() { string address; diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseCachingTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseCachingTests.cs index cd5f58ca20..ce797fc9a0 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseCachingTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseCachingTests.cs @@ -23,7 +23,7 @@ namespace Microsoft.Net.Http.Server _fileLength = new FileInfo(_absoluteFilePath).Length; } - [Fact] + [ConditionalFact] public async Task Caching_SetTtlWithoutContentType_NotCached() { string address; @@ -57,7 +57,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_SetTtlWithContentType_Cached() { string address; @@ -84,7 +84,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] // Http.Sys does not set the optional Age header for cached content. // http://tools.ietf.org/html/rfc7234#section-5.1 public async Task Caching_CheckAge_NotSentWithCachedContent() @@ -115,7 +115,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] // Http.Sys does not update the optional Age header for cached content. // http://tools.ietf.org/html/rfc7234#section-5.1 public async Task Caching_SetAge_AgeHeaderCachedAndNotUpdated() @@ -149,7 +149,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_SetTtlZeroSeconds_NotCached() { string address; @@ -183,7 +183,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_SetTtlMiliseconds_NotCached() { string address; @@ -217,7 +217,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_SetTtlNegative_NotCached() { string address; @@ -251,7 +251,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_SetTtlHuge_Cached() { string address; @@ -278,7 +278,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_SetTtlAndWriteBody_Cached() { string address; @@ -309,7 +309,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_SetTtlAndWriteAsyncBody_Cached() { string address; @@ -340,7 +340,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_Flush_NotCached() { string address; @@ -373,7 +373,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_WriteFlush_NotCached() { string address; @@ -407,7 +407,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_WriteFullContentLength_Cached() { string address; @@ -438,7 +438,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_SendFileNoContentLength_NotCached() { string address; @@ -471,7 +471,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_SendFileWithFullContentLength_Cached() { string address; @@ -502,7 +502,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_SetTtlAndStatusCode_Cached() { string address; @@ -542,7 +542,7 @@ namespace Microsoft.Net.Http.Server } // Only GET requests can have cached responses. - [Theory] + [ConditionalTheory] // See HTTP_VERB for known verbs [InlineData("HEAD")] [InlineData("UNKNOWN")] @@ -600,7 +600,7 @@ namespace Microsoft.Net.Http.Server // RFC violation. http://tools.ietf.org/html/rfc7234#section-4.4 // "A cache MUST invalidate the effective Request URI ... when a non-error status code // is received in response to an unsafe request method." - [Theory] + [ConditionalTheory] // See HTTP_VERB for known verbs [InlineData("HEAD")] [InlineData("UNKNOWN")] @@ -667,7 +667,7 @@ namespace Microsoft.Net.Http.Server // RFC violation / implementation limiation, Vary is not respected. // http://tools.ietf.org/html/rfc7234#section-4.1 - [Fact] + [ConditionalFact] public async Task Caching_SetVary_NotRespected() { string address; @@ -698,7 +698,7 @@ namespace Microsoft.Net.Http.Server } // http://tools.ietf.org/html/rfc7234#section-3.2 - [Fact] + [ConditionalFact] public async Task Caching_RequestAuthorization_NotCached() { string address; @@ -732,7 +732,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_RequestAuthorization_NotServedFromCache() { string address; @@ -768,7 +768,7 @@ namespace Microsoft.Net.Http.Server // Responses can be cached for requests with Pragma: no-cache. // http://tools.ietf.org/html/rfc7234#section-5.2.1.4 - [Fact] + [ConditionalFact] public async Task Caching_RequestPragmaNoCache_Cached() { string address; @@ -797,7 +797,7 @@ namespace Microsoft.Net.Http.Server // RFC violation, Requests with Pragma: no-cache should not be served from cache. // http://tools.ietf.org/html/rfc7234#section-5.4 // http://tools.ietf.org/html/rfc7234#section-5.2.1.4 - [Fact] + [ConditionalFact] public async Task Caching_RequestPragmaNoCache_NotRespectedAndServedFromCache() { string address; @@ -825,7 +825,7 @@ namespace Microsoft.Net.Http.Server // Responses can be cached for requests with cache-control: no-cache. // http://tools.ietf.org/html/rfc7234#section-5.2.1.4 - [Fact] + [ConditionalFact] public async Task Caching_RequestCacheControlNoCache_Cached() { string address; @@ -853,7 +853,7 @@ namespace Microsoft.Net.Http.Server // RFC violation, Requests with Cache-Control: no-cache should not be served from cache. // http://tools.ietf.org/html/rfc7234#section-5.2.1.4 - [Fact] + [ConditionalFact] public async Task Caching_RequestCacheControlNoCache_NotRespectedAndServedFromCache() { string address; @@ -881,7 +881,7 @@ namespace Microsoft.Net.Http.Server // RFC violation // http://tools.ietf.org/html/rfc7234#section-5.2.1.1 - [Fact] + [ConditionalFact] public async Task Caching_RequestCacheControlMaxAgeZero_NotRespectedAndServedFromCache() { string address; @@ -909,7 +909,7 @@ namespace Microsoft.Net.Http.Server // RFC violation // http://tools.ietf.org/html/rfc7234#section-5.2.1.3 - [Fact] + [ConditionalFact] public async Task Caching_RequestCacheControlMinFreshOutOfRange_NotRespectedAndServedFromCache() { string address; @@ -936,7 +936,7 @@ namespace Microsoft.Net.Http.Server } // Http.Sys limitation, partial responses are not cached. - [Fact] + [ConditionalFact] public async Task Caching_CacheRange_NotCached() { string address; @@ -980,7 +980,7 @@ namespace Microsoft.Net.Http.Server } // http://tools.ietf.org/html/rfc7233#section-4.1 - [Fact] + [ConditionalFact] public async Task Caching_RequestRangeFromCache_RangeServedFromCache() { string address; @@ -1010,7 +1010,7 @@ namespace Microsoft.Net.Http.Server } // http://tools.ietf.org/html/rfc7233#section-4.1 - [Fact] + [ConditionalFact] public async Task Caching_RequestMultipleRangesFromCache_RangesServedFromCache() { string address; @@ -1038,7 +1038,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_RequestRangeFromCachedFile_ServedFromCache() { string address; @@ -1070,7 +1070,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Caching_RequestMultipleRangesFromCachedFile_ServedFromCache() { string address; diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseHeaderTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseHeaderTests.cs index af6a828df2..e73b801fc1 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseHeaderTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseHeaderTests.cs @@ -8,6 +8,7 @@ using System.Net; using System.Net.Http; using System.Text; using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Primitives; using Xunit; @@ -15,7 +16,7 @@ namespace Microsoft.Net.Http.Server { public class ResponseHeaderTests { - [Fact] + [ConditionalFact] public async Task ResponseHeaders_11Request_ServerSendsDefaultHeaders() { string address; @@ -37,7 +38,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_10Request_ServerSendsDefaultHeaders() { string address; @@ -60,7 +61,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_11HeadRequest_ServerSendsDefaultHeaders() { string address; @@ -82,7 +83,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_10HeadRequest_ServerSendsDefaultHeaders() { string address; @@ -105,7 +106,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_11HeadRequestWithContentLength_Success() { string address; @@ -128,7 +129,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_11RequestStatusCodeWithoutBody_NoContentLengthOrChunkedOrClose() { string address; @@ -151,7 +152,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_11HeadRequestStatusCodeWithoutBody_NoContentLengthOrChunkedOrClose() { string address; @@ -174,7 +175,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_ServerSendsSingleValueKnownHeaders_Success() { string address; @@ -199,7 +200,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_ServerSendsMultiValueKnownHeaders_Success() { string address; @@ -228,7 +229,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_ServerSendsCustomHeaders_Success() { string address; @@ -257,7 +258,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_ServerSendsConnectionClose_Closed() { string address; @@ -277,7 +278,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_HTTP10Request_Gets11Close() { string address; @@ -296,7 +297,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_HTTP10Request_AllowsManualChunking() { string address; @@ -327,7 +328,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseHeaders_HTTP10KeepAliveRequest_Gets11Close() { string address; @@ -346,7 +347,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Headers_FlushSendsHeaders_Success() { string address; @@ -382,7 +383,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Headers_FlushAsyncSendsHeaders_Success() { string address; @@ -418,7 +419,7 @@ namespace Microsoft.Net.Http.Server } } - [Theory] + [ConditionalTheory] [InlineData("Server", "\r\nData")] [InlineData("Server", "\0Data")] [InlineData("Server", "Data\r")] diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseSendFileTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseSendFileTests.cs index d6fe87fb74..af06647383 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseSendFileTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseSendFileTests.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Net.Http; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing.xunit; using Xunit; namespace Microsoft.Net.Http.Server @@ -25,7 +26,7 @@ namespace Microsoft.Net.Http.Server FileLength = new FileInfo(AbsoluteFilePath).Length; } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_MissingFile_Throws() { string address; @@ -43,7 +44,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_NoHeaders_DefaultsToChunked() { string address; @@ -64,7 +65,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_RelativeFile_Success() { string address; @@ -85,7 +86,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_Unspecified_Chunked() { string address; @@ -106,7 +107,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_MultipleWrites_Chunked() { string address; @@ -128,7 +129,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_HalfOfFile_Chunked() { string address; @@ -149,7 +150,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_OffsetOutOfRange_Throws() { string address; @@ -167,7 +168,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_CountOutOfRange_Throws() { string address; @@ -185,7 +186,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_Count0_Chunked() { string address; @@ -206,7 +207,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_EmptyFileCountUnspecified_SetsChunkedAndFlushesHeaders() { var emptyFilePath = Path.Combine(Directory.GetCurrentDirectory(), "zz_" + Guid.NewGuid().ToString() + "EmptyTestFile.txt"); @@ -234,7 +235,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_ContentLength_PassedThrough() { string address; @@ -256,7 +257,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_ContentLengthSpecific_PassedThrough() { string address; @@ -279,7 +280,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_ContentLength0_PassedThrough() { string address; @@ -302,7 +303,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_WithActiveCancellationToken_Success() { string address; @@ -323,7 +324,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_WithTimerCancellationToken_Success() { string address; @@ -345,7 +346,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFileWriteExceptions_FirstCallWithCanceledCancellationToken_CancelsAndAborts() { string address; @@ -375,7 +376,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_FirstSendWithCanceledCancellationToken_CancelsAndAborts() { string address; @@ -404,7 +405,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFileExceptions_SecondSendWithCanceledCancellationToken_CancelsAndAborts() { string address; @@ -426,7 +427,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_SecondSendWithCanceledCancellationToken_CancelsAndAborts() { string address; @@ -447,7 +448,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFileExceptions_ClientDisconnectsBeforeFirstSend_SendThrows() { string address; @@ -480,7 +481,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_ClientDisconnectsBeforeFirstSend_SendCompletesSilently() { string address; @@ -503,7 +504,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFileExceptions_ClientDisconnectsBeforeSecondSend_SendThrows() { string address; @@ -537,7 +538,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task ResponseSendFile_ClientDisconnectsBeforeSecondSend_SendCompletesSilently() { string address; diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseTests.cs index fe6fc0c827..0fab49a9ae 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/ResponseTests.cs @@ -5,13 +5,14 @@ using System; using System.Net; using System.Net.Http; using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing.xunit; using Xunit; namespace Microsoft.Net.Http.Server { public class ResponseTests { - [Fact] + [ConditionalFact] public async Task Response_ServerSendsDefaultResponse_ServerProvidesStatusCodeAndReasonPhrase() { string address; @@ -31,7 +32,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Response_ServerSendsSpecificStatus_ServerProvidesReasonPhrase() { string address; @@ -52,7 +53,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Response_ServerSendsSpecificStatusAndReasonPhrase_PassedThrough() { string address; @@ -74,7 +75,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Response_ServerSendsCustomStatus_NoReasonPhrase() { string address; @@ -93,7 +94,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Response_100_Throws() { string address; @@ -109,7 +110,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Response_0_Throws() { string address; diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/ServerTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/ServerTests.cs index 65d7691dd3..05a433a3d2 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/ServerTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/ServerTests.cs @@ -16,7 +16,7 @@ namespace Microsoft.Net.Http.Server { public class ServerTests { - [Fact] + [ConditionalFact] public async Task Server_200OK_Success() { string address; @@ -32,7 +32,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Server_SendHelloWorld_Success() { string address; @@ -52,7 +52,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Server_EchoHelloWorld_Success() { string address; @@ -74,7 +74,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Server_ClientDisconnects_CallCanceled() { var interval = TimeSpan.FromSeconds(1); @@ -105,7 +105,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Server_TokenRegisteredAfterClientDisconnects_CallCanceled() { var interval = TimeSpan.FromSeconds(1); @@ -136,7 +136,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Server_TokenRegisteredAfterResponseSent_Success() { var interval = TimeSpan.FromSeconds(1); @@ -167,7 +167,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Server_Abort_CallCanceled() { var interval = TimeSpan.FromSeconds(1); @@ -195,7 +195,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Server_ConnectionCloseHeader_CancellationTokenFires() { var interval = TimeSpan.FromSeconds(1); @@ -228,7 +228,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Server_SetQueueLimit_Success() { string address; @@ -245,7 +245,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Server_HotAddPrefix_Success() { string address; @@ -276,7 +276,7 @@ namespace Microsoft.Net.Http.Server } } - [Fact] + [ConditionalFact] public async Task Server_HotRemovePrefix_Success() { string address; diff --git a/test/Microsoft.Net.Http.Server.FunctionalTests/WebSocketTests.cs b/test/Microsoft.Net.Http.Server.FunctionalTests/WebSocketTests.cs index dbfcaa2e05..eadc50f7cf 100644 --- a/test/Microsoft.Net.Http.Server.FunctionalTests/WebSocketTests.cs +++ b/test/Microsoft.Net.Http.Server.FunctionalTests/WebSocketTests.cs @@ -12,10 +12,10 @@ using Xunit; namespace Microsoft.Net.Http.Server { + [OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)] public class WebSocketTests { [ConditionalFact] - [OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)] public async Task WebSocketAccept_AfterHeadersSent_Throws() { string address; @@ -36,7 +36,6 @@ namespace Microsoft.Net.Http.Server } [ConditionalFact] - [OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)] public async Task WebSocketAccept_Success() { string address; @@ -54,7 +53,6 @@ namespace Microsoft.Net.Http.Server } [ConditionalFact] - [OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)] public async Task WebSocketAccept_SendAndReceive_Success() { string address;