Upgrade to xunit 2.3.0-beta4

Includes a few changes as required by the new analyzers in the upgrade.
This commit is contained in:
Nate McMaster 2017-08-22 18:22:17 -07:00
parent cbde649047
commit 5d2b1000f1
8 changed files with 16 additions and 12 deletions

View File

@ -11,6 +11,8 @@
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign> <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
<VersionSuffix Condition="'$(VersionSuffix)'!='' AND '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix> <VersionSuffix Condition="'$(VersionSuffix)'!='' AND '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<!-- ignore failures in xunit.analyzers 0.6.1 -->
<NoWarn>$(NoWarn);AD0001</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -5,7 +5,8 @@
<InternalAspNetCoreSdkVersion>2.1.1-*</InternalAspNetCoreSdkVersion> <InternalAspNetCoreSdkVersion>2.1.1-*</InternalAspNetCoreSdkVersion>
<NETStandardImplicitPackageVersion>2.0.0-*</NETStandardImplicitPackageVersion> <NETStandardImplicitPackageVersion>2.0.0-*</NETStandardImplicitPackageVersion>
<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> <XunitAnalyzersVersion>0.6.1</XunitAnalyzersVersion>
<XunitVersion>2.3.0-beta4-build3742</XunitVersion>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -146,12 +146,12 @@ namespace Microsoft.AspNetCore.StaticFiles
Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal("text/plain", response.Content.Headers.ContentType.ToString()); Assert.Equal("text/plain", response.Content.Headers.ContentType.ToString());
Assert.True(response.Content.Headers.ContentLength == fileInfo.Length); Assert.True(response.Content.Headers.ContentLength == fileInfo.Length);
Assert.Equal(0, (await response.Content.ReadAsByteArrayAsync()).Length); Assert.Empty((await response.Content.ReadAsByteArrayAsync()));
} }
} }
} }
public static IEnumerable<string[]> ExistingFiles => new[] public static IEnumerable<object[]> ExistingFiles => new[]
{ {
new[] {"", @".", "/TestDocument.txt"}, new[] {"", @".", "/TestDocument.txt"},
new[] {"/somedir", @".", "/somedir/TestDocument.txt"}, new[] {"/somedir", @".", "/somedir/TestDocument.txt"},

View File

@ -412,13 +412,13 @@ namespace Microsoft.AspNetCore.StaticFiles
} }
public static IEnumerable<object> SupportedMethods => new[] public static IEnumerable<object[]> SupportedMethods => new[]
{ {
new [] { HttpMethod.Get }, new [] { HttpMethod.Get },
new [] { HttpMethod.Head } new [] { HttpMethod.Head }
}; };
public static IEnumerable<object> UnsupportedMethods => new[] public static IEnumerable<object[]> UnsupportedMethods => new[]
{ {
new [] { HttpMethod.Post }, new [] { HttpMethod.Post },
new [] { HttpMethod.Put }, new [] { HttpMethod.Put },

View File

@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.StaticFiles
Assert.Equal(HttpStatusCode.Moved, response.StatusCode); Assert.Equal(HttpStatusCode.Moved, response.StatusCode);
Assert.Equal(requestUrl + "/" + queryString, response.Headers.GetValues("Location").FirstOrDefault()); Assert.Equal(requestUrl + "/" + queryString, response.Headers.GetValues("Location").FirstOrDefault());
Assert.Equal(0, (await response.Content.ReadAsByteArrayAsync()).Length); Assert.Empty((await response.Content.ReadAsByteArrayAsync()));
} }
} }

View File

@ -165,7 +165,7 @@ namespace Microsoft.AspNetCore.StaticFiles
Assert.Equal(HttpStatusCode.Moved, response.StatusCode); Assert.Equal(HttpStatusCode.Moved, response.StatusCode);
Assert.Equal(requestUrl + "/" + queryString, response.Headers.GetValues("Location").FirstOrDefault()); Assert.Equal(requestUrl + "/" + queryString, response.Headers.GetValues("Location").FirstOrDefault());
Assert.Equal(0, (await response.Content.ReadAsByteArrayAsync()).Length); Assert.Empty((await response.Content.ReadAsByteArrayAsync()));
} }
} }
@ -241,7 +241,7 @@ namespace Microsoft.AspNetCore.StaticFiles
Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal("text/html; charset=utf-8", response.Content.Headers.ContentType.ToString()); Assert.Equal("text/html; charset=utf-8", response.Content.Headers.ContentType.ToString());
Assert.True(response.Content.Headers.ContentLength == 0); Assert.True(response.Content.Headers.ContentLength == 0);
Assert.Equal(0, (await response.Content.ReadAsByteArrayAsync()).Length); Assert.Empty((await response.Content.ReadAsByteArrayAsync()));
} }
} }
} }

View File

@ -23,6 +23,7 @@
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.AspNetCore.TestHost" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="xunit.analyzers" Version="$(XunitAnalyzersVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" /> <PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" /> <PackageReference Include="xunit" Version="$(XunitVersion)" />
</ItemGroup> </ItemGroup>

View File

@ -128,7 +128,7 @@ namespace Microsoft.AspNetCore.StaticFiles
Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal("text/plain", response.Content.Headers.ContentType.ToString()); Assert.Equal("text/plain", response.Content.Headers.ContentType.ToString());
Assert.True(response.Content.Headers.ContentLength == fileInfo.Length); Assert.True(response.Content.Headers.ContentLength == fileInfo.Length);
Assert.Equal(0, (await response.Content.ReadAsByteArrayAsync()).Length); Assert.Empty((await response.Content.ReadAsByteArrayAsync()));
} }
} }
@ -187,7 +187,7 @@ namespace Microsoft.AspNetCore.StaticFiles
} }
} }
public static IEnumerable<string[]> MissingFiles => new[] public static IEnumerable<object[]> MissingFiles => new[]
{ {
new[] {"", @".", "/missing.file"}, new[] {"", @".", "/missing.file"},
new[] {"/subdir", @".", "/subdir/missing.file"}, new[] {"/subdir", @".", "/subdir/missing.file"},
@ -195,7 +195,7 @@ namespace Microsoft.AspNetCore.StaticFiles
new[] {"", @"./", "/xunit.xml"} new[] {"", @"./", "/xunit.xml"}
}; };
public static IEnumerable<string[]> ExistingFiles => new[] public static IEnumerable<object[]> ExistingFiles => new[]
{ {
new[] {"", @".", "/TestDocument.txt"}, new[] {"", @".", "/TestDocument.txt"},
new[] {"/somedir", @".", "/somedir/TestDocument.txt"}, new[] {"/somedir", @".", "/somedir/TestDocument.txt"},