Upgrade test framework versions and fix test issues

This commit is contained in:
Nate McMaster 2017-05-15 14:54:39 -07:00
parent 043f8fda61
commit bf0b0e283d
20 changed files with 30 additions and 64 deletions

View File

@ -4,7 +4,7 @@
<CoreFxVersion>4.3.0</CoreFxVersion>
<InternalAspNetCoreSdkVersion>2.1.0-*</InternalAspNetCoreSdkVersion>
<NETStandardImplicitPackageVersion>$(BundledNETStandardPackageVersion)</NETStandardImplicitPackageVersion>
<TestSdkVersion>15.0.0</TestSdkVersion>
<XunitVersion>2.2.0</XunitVersion>
<TestSdkVersion>15.3.0-*</TestSdkVersion>
<XunitVersion>2.3.0-beta2-*</XunitVersion>
</PropertyGroup>
</Project>

View File

@ -12,8 +12,4 @@
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

View File

@ -50,9 +50,9 @@ namespace Microsoft.AspNetCore.Authentication
props.StoreTokens(new[] { new AuthenticationToken { Name = "Zero", Value = "0" } });
Assert.Equal("0", props.GetTokenValue("Zero"));
Assert.Equal(null, props.GetTokenValue("One"));
Assert.Equal(null, props.GetTokenValue("Two"));
Assert.Equal(null, props.GetTokenValue("Three"));
Assert.Null(props.GetTokenValue("One"));
Assert.Null(props.GetTokenValue("Two"));
Assert.Null(props.GetTokenValue("Three"));
Assert.Equal(1, props.GetTokens().Count());
}

View File

@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Http.Abstractions.Tests
public void Equals_EmptyFragmentStringAndDefaultFragmentString()
{
// Act and Assert
Assert.Equal(FragmentString.Empty, default(FragmentString));
Assert.Equal(default(FragmentString), FragmentString.Empty);
Assert.Equal(default(FragmentString), FragmentString.Empty);
// explicitly checking == operator
Assert.True(FragmentString.Empty == default(FragmentString));
@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Http.Abstractions.Tests
var fragmentString = new FragmentString("#col=1");
// Act and Assert
Assert.NotEqual(fragmentString, default(FragmentString));
Assert.NotEqual(default(FragmentString), fragmentString);
}
[Fact]

View File

@ -70,7 +70,7 @@ namespace Microsoft.AspNetCore.Http
var result = hostString.Port;
// Assert
Assert.Equal(null, result);
Assert.Null(result);
}
[Theory]
@ -97,7 +97,7 @@ namespace Microsoft.AspNetCore.Http
public void Equals_EmptyHostStringAndDefaultHostString()
{
// Act and Assert
Assert.Equal(new HostString(string.Empty), default(HostString));
Assert.Equal(default(HostString), new HostString(string.Empty));
Assert.Equal(default(HostString), new HostString(string.Empty));
// explicitly checking == operator
Assert.True(new HostString(string.Empty) == default(HostString));
@ -111,7 +111,7 @@ namespace Microsoft.AspNetCore.Http
var hostString = new HostString("example.com");
// Act and Assert
Assert.NotEqual(hostString, default(HostString));
Assert.NotEqual(default(HostString), hostString);
}
[Fact]

View File

@ -17,8 +17,4 @@
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

View File

@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Http
public void Equals_EmptyPathStringAndDefaultPathString()
{
// Act and Assert
Assert.Equal(PathString.Empty, default(PathString));
Assert.Equal(default(PathString), PathString.Empty);
Assert.Equal(default(PathString), PathString.Empty);
Assert.True(PathString.Empty == default(PathString));
Assert.True(default(PathString) == PathString.Empty);
@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Http
var pathString = new PathString("/hello");
// Act and Assert
Assert.NotEqual(pathString, default(PathString));
Assert.NotEqual(default(PathString), pathString);
}
[Fact]

View File

@ -110,7 +110,7 @@ namespace Microsoft.AspNetCore.Http.Abstractions
public void Equals_EmptyQueryStringAndDefaultQueryString()
{
// Act and Assert
Assert.Equal(QueryString.Empty, default(QueryString));
Assert.Equal(default(QueryString), QueryString.Empty);
Assert.Equal(default(QueryString), QueryString.Empty);
// explicitly checking == operator
Assert.True(QueryString.Empty == default(QueryString));
@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.Http.Abstractions
var queryString = new QueryString("?foo=1");
// Act and Assert
Assert.NotEqual(queryString, default(QueryString));
Assert.NotEqual(default(QueryString), queryString);
}
[Fact]

View File

@ -224,8 +224,8 @@ namespace Microsoft.AspNetCore.Http
sp.AddService(typeof(IMiddlewareFactory), middlewareFactory);
context.RequestServices = sp;
await app(context);
Assert.Equal(true, context.Items["before"]);
Assert.Equal(true, context.Items["after"]);
Assert.True(Assert.IsType<bool>(context.Items["before"]));
Assert.True(Assert.IsType<bool>(context.Items["after"]));
Assert.NotNull(middlewareFactory.Created);
Assert.NotNull(middlewareFactory.Released);
Assert.IsType(typeof(Middleware), middlewareFactory.Created);
@ -374,4 +374,4 @@ namespace Microsoft.AspNetCore.Http
public Task InvokeAsync(HttpContext context) => TaskCache.CompletedTask;
}
}
}
}

View File

@ -18,8 +18,4 @@
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

View File

@ -16,8 +16,4 @@
<PackageReference Include="xunit" Version="$(XunitVersion)" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

View File

@ -202,7 +202,7 @@ namespace Microsoft.AspNetCore.Http.Features
{
Assert.True(body.CanSeek);
var content = reader.ReadToEnd();
Assert.Equal(content, "<html><body>Hello World</body></html>");
Assert.Equal("<html><body>Hello World</body></html>", content);
}
await responseFeature.CompleteAsync();
@ -250,7 +250,7 @@ namespace Microsoft.AspNetCore.Http.Features
{
Assert.True(body.CanSeek);
var content = reader.ReadToEnd();
Assert.Equal(content, "<html><body>Hello World</body></html>");
Assert.Equal("<html><body>Hello World</body></html>", content);
}
await responseFeature.CompleteAsync();
@ -297,7 +297,7 @@ namespace Microsoft.AspNetCore.Http.Features
{
Assert.True(body.CanSeek);
var content = reader.ReadToEnd();
Assert.Equal(content, "<html><body>Hello World</body></html>");
Assert.Equal("<html><body>Hello World</body></html>", content);
}
await responseFeature.CompleteAsync();
@ -324,7 +324,7 @@ namespace Microsoft.AspNetCore.Http.Features
context.Features.Set<IFormFeature>(formFeature);
var exception = await Assert.ThrowsAsync<InvalidDataException> (() => context.Request.ReadFormAsync());
Assert.Equal(exception.Message, "Form value count limit 2 exceeded.");
Assert.Equal("Form value count limit 2 exceeded.", exception.Message);
}
[Theory]
@ -349,7 +349,7 @@ namespace Microsoft.AspNetCore.Http.Features
context.Features.Set<IFormFeature>(formFeature);
var exception = await Assert.ThrowsAsync<InvalidDataException> (() => context.Request.ReadFormAsync());
Assert.Equal(exception.Message, "Form value count limit 2 exceeded.");
Assert.Equal("Form value count limit 2 exceeded.", exception.Message);
}
[Theory]

View File

@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Builder.Internal
var httpContext = new DefaultHttpContext();
app.Invoke(httpContext);
Assert.Equal(httpContext.Response.StatusCode, 404);
Assert.Equal(404, httpContext.Response.StatusCode);
}
[Fact]
@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.Builder.Internal
var builder2 = builder1.New();
builder2.Properties["test"] = "value2";
Assert.Equal(builder1.Properties["test"], "value1");
Assert.Equal("value1", builder1.Properties["test"]);
}
}
}

View File

@ -4,8 +4,6 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
<ItemGroup>
@ -18,8 +16,4 @@
<PackageReference Include="xunit" Version="$(XunitVersion)" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

View File

@ -18,8 +18,4 @@
<PackageReference Include="xunit" Version="$(XunitVersion)" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

View File

@ -35,9 +35,9 @@ namespace Microsoft.AspNetCore.Owin
var requestFeature = Get<IHttpRequestFeature>(features);
Assert.Equal(requestFeature.Method, HttpMethods.Post);
Assert.Equal(requestFeature.Path, "/path");
Assert.Equal(requestFeature.PathBase, "/pathBase");
Assert.Equal(requestFeature.QueryString, "?name=value");
Assert.Equal("/path", requestFeature.Path);
Assert.Equal("/pathBase", requestFeature.PathBase);
Assert.Equal("?name=value", requestFeature.QueryString);
}
[Fact]

View File

@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.WebUtilities.Test
var read = await reader.ReadAsync(chars, 4, 3);
// Assert
Assert.Equal(read, 3);
Assert.Equal(3, read);
for (var i = 0; i < 3; i++)
{
Assert.Equal(CharData[i], chars[i + 4]);

View File

@ -16,8 +16,4 @@
<PackageReference Include="xunit" Version="$(XunitVersion)" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

View File

@ -16,8 +16,4 @@
<PackageReference Include="xunit" Version="$(XunitVersion)" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

View File

@ -72,7 +72,7 @@ namespace Microsoft.Net.Http.Headers
// Change one value and verify the other is unchanged.
pair0.Value = "othervalue";
Assert.Equal("othervalue", pair0.Value);
Assert.Equal(null, pair1.Value);
Assert.Null(pair1.Value);
}
[Fact]
@ -90,7 +90,7 @@ namespace Microsoft.Net.Http.Headers
// Change one value and verify the other is unchanged.
pair0.Value = "othervalue";
Assert.Equal("othervalue", pair0.Value);
Assert.Equal(null, pair1.Value);
Assert.Null(pair1.Value);
Assert.Throws<InvalidOperationException>(() => { pair1.Value = "othervalue"; });
}