Upgrade to xunit 2.3.0-beta4

This commit is contained in:
Nate McMaster 2017-08-22 15:43:31 -07:00
parent dc8d1d0788
commit c36b18d80e
8 changed files with 27 additions and 31 deletions

View File

@ -6,7 +6,7 @@
<NETStandardImplicitPackageVersion>2.0.0-*</NETStandardImplicitPackageVersion> <NETStandardImplicitPackageVersion>2.0.0-*</NETStandardImplicitPackageVersion>
<NETStandardLibraryNETFrameworkVersion>2.0.0-*</NETStandardLibraryNETFrameworkVersion> <NETStandardLibraryNETFrameworkVersion>2.0.0-*</NETStandardLibraryNETFrameworkVersion>
<RuntimeFrameworkVersion Condition="'$(TargetFramework)'=='netcoreapp2.0'">2.0.0-*</RuntimeFrameworkVersion> <RuntimeFrameworkVersion Condition="'$(TargetFramework)'=='netcoreapp2.0'">2.0.0-*</RuntimeFrameworkVersion>
<TestSdkVersion>15.3.0-*</TestSdkVersion> <TestSdkVersion>15.3.0</TestSdkVersion>
<XunitVersion>2.3.0-beta2-*</XunitVersion> <XunitVersion>2.3.0-beta4-build3742</XunitVersion>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
{ {
var response = await SendRequestAsync(address); var response = await SendRequestAsync(address);
Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal(0, response.Headers.WwwAuthenticate.Count); Assert.Empty(response.Headers.WwwAuthenticate);
} }
} }
@ -186,7 +186,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
{ {
var response = await SendRequestAsync(address); var response = await SendRequestAsync(address);
Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal(0, response.Headers.WwwAuthenticate.Count); Assert.Empty(response.Headers.WwwAuthenticate);
} }
} }
@ -306,12 +306,8 @@ namespace Microsoft.AspNetCore.Server.HttpSys
} }
} }
[ConditionalTheory] [ConditionalFact]
[InlineData(AuthenticationSchemes.Negotiate)] public async Task AuthTypes_Forbid_Forbidden()
[InlineData(AuthenticationSchemes.NTLM)]
// [InlineData(AuthenticationSchemes.Digest)]
[InlineData(AuthenticationSchemes.Basic)]
public async Task AuthTypes_Forbid_Forbidden(AuthenticationSchemes authType)
{ {
var authTypes = AuthenticationSchemes.Negotiate | AuthenticationSchemes.NTLM | /*AuthenticationSchemes.Digest |*/ AuthenticationSchemes.Basic; var authTypes = AuthenticationSchemes.Negotiate | AuthenticationSchemes.NTLM | /*AuthenticationSchemes.Digest |*/ AuthenticationSchemes.Basic;
using (var server = Utilities.CreateDynamicHost(authTypes, AllowAnoymous, out var address, httpContext => using (var server = Utilities.CreateDynamicHost(authTypes, AllowAnoymous, out var address, httpContext =>
@ -324,7 +320,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
{ {
var response = await SendRequestAsync(address); var response = await SendRequestAsync(address);
Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode); Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
Assert.Equal(0, response.Headers.WwwAuthenticate.Count); Assert.Empty(response.Headers.WwwAuthenticate);
} }
} }
@ -345,7 +341,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
{ {
var response = await SendRequestAsync(address, useDefaultCredentials: true); var response = await SendRequestAsync(address, useDefaultCredentials: true);
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
Assert.Equal(1, response.Headers.WwwAuthenticate.Count); Assert.Single(response.Headers.WwwAuthenticate);
Assert.Equal(authType.ToString(), response.Headers.WwwAuthenticate.First().Scheme); Assert.Equal(authType.ToString(), response.Headers.WwwAuthenticate.First().Scheme);
} }
} }

View File

@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
var response = await responseTask; var response = await responseTask;
Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal(0, response.Headers.WwwAuthenticate.Count); Assert.Empty(response.Headers.WwwAuthenticate);
} }
} }

View File

@ -1083,7 +1083,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
response = await SendRequestAsync(address, "GET", "Range", "bytes=0-10,15-20"); response = await SendRequestAsync(address, "GET", "Range", "bytes=0-10,15-20");
Assert.Equal(206, (int)response.StatusCode); Assert.Equal(206, (int)response.StatusCode);
Assert.Equal("1", response.Headers.GetValues("x-request-count").FirstOrDefault()); Assert.Equal("1", response.Headers.GetValues("x-request-count").FirstOrDefault());
Assert.True(response.Content.Headers.GetValues("content-type").First().StartsWith("multipart/byteranges;")); Assert.StartsWith("multipart/byteranges;", response.Content.Headers.GetValues("content-type").First());
} }
} }
@ -1145,7 +1145,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
response = await SendRequestAsync(address, "GET", "Range", "bytes=0-" + (rangeLength - 1) + "," + rangeLength + "-" + (rangeLength + rangeLength - 1), HttpCompletionOption.ResponseHeadersRead); response = await SendRequestAsync(address, "GET", "Range", "bytes=0-" + (rangeLength - 1) + "," + rangeLength + "-" + (rangeLength + rangeLength - 1), HttpCompletionOption.ResponseHeadersRead);
Assert.Equal(206, (int)response.StatusCode); Assert.Equal(206, (int)response.StatusCode);
Assert.Equal("1", response.Headers.GetValues("x-request-count").FirstOrDefault()); Assert.Equal("1", response.Headers.GetValues("x-request-count").FirstOrDefault());
Assert.True(response.Content.Headers.GetValues("content-type").First().StartsWith("multipart/byteranges;")); Assert.StartsWith("multipart/byteranges;", response.Content.Headers.GetValues("content-type").First());
} }
} }

View File

@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
Assert.False(response.Headers.TransferEncodingChunked.HasValue); Assert.False(response.Headers.TransferEncodingChunked.HasValue);
Assert.True(response.Headers.Date.HasValue); Assert.True(response.Headers.Date.HasValue);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString()); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString());
Assert.Equal(1, response.Content.Headers.Count()); Assert.Single(response.Content.Headers);
Assert.Equal(0, response.Content.Headers.ContentLength); Assert.Equal(0, response.Content.Headers.ContentLength);
} }
} }
@ -63,7 +63,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
Assert.True(response.Headers.ConnectionClose.Value); Assert.True(response.Headers.ConnectionClose.Value);
Assert.True(response.Headers.Date.HasValue); Assert.True(response.Headers.Date.HasValue);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString()); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString());
Assert.Equal(1, response.Content.Headers.Count()); Assert.Single(response.Content.Headers);
Assert.Equal(0, response.Content.Headers.ContentLength); Assert.Equal(0, response.Content.Headers.ContentLength);
} }
} }
@ -86,7 +86,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
Assert.True(response.Headers.Date.HasValue); Assert.True(response.Headers.Date.HasValue);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString()); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString());
Assert.False(response.Content.Headers.Contains("Content-Length")); Assert.False(response.Content.Headers.Contains("Content-Length"));
Assert.Equal(0, response.Content.Headers.Count()); Assert.Empty(response.Content.Headers);
// Send a second request to check that the connection wasn't corrupted. // Send a second request to check that the connection wasn't corrupted.
responseTask = SendHeadRequestAsync(address); responseTask = SendHeadRequestAsync(address);
@ -115,7 +115,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
Assert.True(response.Headers.Date.HasValue); Assert.True(response.Headers.Date.HasValue);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString()); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString());
Assert.False(response.Content.Headers.Contains("Content-Length")); Assert.False(response.Content.Headers.Contains("Content-Length"));
Assert.Equal(0, response.Content.Headers.Count()); Assert.Empty(response.Content.Headers);
// Send a second request to check that the connection wasn't corrupted. // Send a second request to check that the connection wasn't corrupted.
responseTask = SendHeadRequestAsync(address); responseTask = SendHeadRequestAsync(address);
@ -143,7 +143,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
Assert.False(response.Headers.TransferEncodingChunked.HasValue); Assert.False(response.Headers.TransferEncodingChunked.HasValue);
Assert.True(response.Headers.Date.HasValue); Assert.True(response.Headers.Date.HasValue);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString()); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString());
Assert.Equal(1, response.Content.Headers.Count()); Assert.Single(response.Content.Headers);
Assert.Equal(20, response.Content.Headers.ContentLength); Assert.Equal(20, response.Content.Headers.ContentLength);
// Send a second request to check that the connection wasn't corrupted. // Send a second request to check that the connection wasn't corrupted.
@ -173,7 +173,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
Assert.True(response.Headers.Date.HasValue); Assert.True(response.Headers.Date.HasValue);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString()); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString());
Assert.False(response.Content.Headers.Contains("Content-Length")); Assert.False(response.Content.Headers.Contains("Content-Length"));
Assert.Equal(0, response.Content.Headers.Count()); Assert.Empty(response.Content.Headers);
} }
} }
@ -196,7 +196,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
Assert.True(response.Headers.Date.HasValue); Assert.True(response.Headers.Date.HasValue);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString()); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString());
Assert.False(response.Content.Headers.Contains("Content-Length")); Assert.False(response.Content.Headers.Contains("Content-Length"));
Assert.Equal(0, response.Content.Headers.Count()); Assert.Empty(response.Content.Headers);
// Send a second request to check that the connection wasn't corrupted. // Send a second request to check that the connection wasn't corrupted.
responseTask = SendHeadRequestAsync(address); responseTask = SendHeadRequestAsync(address);
@ -414,7 +414,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
Assert.Equal(2, response.Headers.GetValues("Custom1").Count()); Assert.Equal(2, response.Headers.GetValues("Custom1").Count());
Assert.Equal("value1a", response.Headers.GetValues("Custom1").First()); Assert.Equal("value1a", response.Headers.GetValues("Custom1").First());
Assert.Equal("value1b", response.Headers.GetValues("Custom1").Skip(1).First()); Assert.Equal("value1b", response.Headers.GetValues("Custom1").Skip(1).First());
Assert.Equal(1, response.Headers.GetValues("Custom2").Count()); Assert.Single(response.Headers.GetValues("Custom2"));
Assert.Equal("value2a, value2b", response.Headers.GetValues("Custom2").First()); Assert.Equal("value2a, value2b", response.Headers.GetValues("Custom2").First());
} }
} }
@ -450,7 +450,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
Assert.Equal(2, response.Headers.GetValues("Custom1").Count()); Assert.Equal(2, response.Headers.GetValues("Custom1").Count());
Assert.Equal("value1a", response.Headers.GetValues("Custom1").First()); Assert.Equal("value1a", response.Headers.GetValues("Custom1").First());
Assert.Equal("value1b", response.Headers.GetValues("Custom1").Skip(1).First()); Assert.Equal("value1b", response.Headers.GetValues("Custom1").Skip(1).First());
Assert.Equal(1, response.Headers.GetValues("Custom2").Count()); Assert.Single(response.Headers.GetValues("Custom2"));
Assert.Equal("value2a, value2b", response.Headers.GetValues("Custom2").First()); Assert.Equal("value2a, value2b", response.Headers.GetValues("Custom2").First());
} }
} }

View File

@ -203,7 +203,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
IEnumerable<string> contentLength; IEnumerable<string> contentLength;
Assert.False(response.Content.Headers.TryGetValues("content-length", out contentLength), "Content-Length"); Assert.False(response.Content.Headers.TryGetValues("content-length", out contentLength), "Content-Length");
Assert.True(response.Headers.TransferEncodingChunked.Value); Assert.True(response.Headers.TransferEncodingChunked.Value);
Assert.Equal(0, (await response.Content.ReadAsByteArrayAsync()).Length); Assert.Empty((await response.Content.ReadAsByteArrayAsync()));
} }
} }
@ -299,7 +299,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
Assert.True(response.Content.Headers.TryGetValues("content-length", out contentLength), "Content-Length"); Assert.True(response.Content.Headers.TryGetValues("content-length", out contentLength), "Content-Length");
Assert.Equal("0", contentLength.First()); Assert.Equal("0", contentLength.First());
Assert.Null(response.Headers.TransferEncodingChunked); Assert.Null(response.Headers.TransferEncodingChunked);
Assert.Equal(0, (await response.Content.ReadAsByteArrayAsync()).Length); Assert.Empty((await response.Content.ReadAsByteArrayAsync()));
} }
} }

View File

@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
Assert.False(response.Headers.TransferEncodingChunked.HasValue); Assert.False(response.Headers.TransferEncodingChunked.HasValue);
Assert.True(response.Headers.Date.HasValue); Assert.True(response.Headers.Date.HasValue);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString()); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers.Server.ToString());
Assert.Equal(1, response.Content.Headers.Count()); Assert.Single(response.Content.Headers);
Assert.Equal(0, response.Content.Headers.ContentLength); Assert.Equal(0, response.Content.Headers.ContentLength);
} }
} }
@ -224,7 +224,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
Assert.Equal(2, response.Headers.GetValues("Custom1").Count()); Assert.Equal(2, response.Headers.GetValues("Custom1").Count());
Assert.Equal("value1a", response.Headers.GetValues("Custom1").First()); Assert.Equal("value1a", response.Headers.GetValues("Custom1").First());
Assert.Equal("value1b", response.Headers.GetValues("Custom1").Skip(1).First()); Assert.Equal("value1b", response.Headers.GetValues("Custom1").Skip(1).First());
Assert.Equal(1, response.Headers.GetValues("Custom2").Count()); Assert.Single(response.Headers.GetValues("Custom2"));
Assert.Equal("value2a, value2b", response.Headers.GetValues("Custom2").First()); Assert.Equal("value2a, value2b", response.Headers.GetValues("Custom2").First());
} }
} }
@ -254,7 +254,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
Assert.Equal(2, response.Headers.GetValues("Custom1").Count()); Assert.Equal(2, response.Headers.GetValues("Custom1").Count());
Assert.Equal("value1a", response.Headers.GetValues("Custom1").First()); Assert.Equal("value1a", response.Headers.GetValues("Custom1").First());
Assert.Equal("value1b", response.Headers.GetValues("Custom1").Skip(1).First()); Assert.Equal("value1b", response.Headers.GetValues("Custom1").Skip(1).First());
Assert.Equal(1, response.Headers.GetValues("Custom2").Count()); Assert.Single(response.Headers.GetValues("Custom2"));
Assert.Equal("value2a, value2b", response.Headers.GetValues("Custom2").First()); Assert.Equal("value2a, value2b", response.Headers.GetValues("Custom2").First());
} }
} }

View File

@ -253,7 +253,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
IEnumerable<string> contentLength; IEnumerable<string> contentLength;
Assert.False(response.Content.Headers.TryGetValues("content-length", out contentLength), "Content-Length"); Assert.False(response.Content.Headers.TryGetValues("content-length", out contentLength), "Content-Length");
Assert.True(response.Headers.TransferEncodingChunked.Value); Assert.True(response.Headers.TransferEncodingChunked.Value);
Assert.Equal(0, (await response.Content.ReadAsByteArrayAsync()).Length); Assert.Empty((await response.Content.ReadAsByteArrayAsync()));
} }
} }
@ -316,7 +316,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
Assert.True(response.Content.Headers.TryGetValues("content-length", out contentLength), "Content-Length"); Assert.True(response.Content.Headers.TryGetValues("content-length", out contentLength), "Content-Length");
Assert.Equal("0", contentLength.First()); Assert.Equal("0", contentLength.First());
Assert.Null(response.Headers.TransferEncodingChunked); Assert.Null(response.Headers.TransferEncodingChunked);
Assert.Equal(0, (await response.Content.ReadAsByteArrayAsync()).Length); Assert.Empty((await response.Content.ReadAsByteArrayAsync()));
} }
} }