Upgrade test framework versions and fix test issues

This commit is contained in:
Nate McMaster 2017-05-12 14:55:08 -07:00
parent 4855727186
commit d075f1bcea
13 changed files with 42 additions and 33 deletions

View File

@ -5,7 +5,7 @@
<InternalAspNetCoreSdkVersion>2.1.0-*</InternalAspNetCoreSdkVersion>
<MoqVersion>4.7.1</MoqVersion>
<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

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

View File

@ -229,8 +229,17 @@ namespace Microsoft.AspNetCore.Routing.Tests
Assert.IsType<RouteValueDictionary.PropertyStorage>(dict._storage);
Assert.Collection(
dict.OrderBy(kvp => kvp.Key),
kvp => { Assert.Equal("CoolnessFactor", kvp.Key); Assert.Equal(73, kvp.Value); },
kvp => { Assert.Equal("IsAwesome", kvp.Key); Assert.Equal(false, kvp.Value); });
kvp =>
{
Assert.Equal("CoolnessFactor", kvp.Key);
Assert.Equal(73, kvp.Value);
},
kvp =>
{
Assert.Equal("IsAwesome", kvp.Key);
var value = Assert.IsType<bool>(kvp.Value);
Assert.False(value);
});
}
[Fact]
@ -246,7 +255,12 @@ namespace Microsoft.AspNetCore.Routing.Tests
Assert.IsType<RouteValueDictionary.PropertyStorage>(dict._storage);
Assert.Collection(
dict.OrderBy(kvp => kvp.Key),
kvp => { Assert.Equal("IsPublic", kvp.Key); Assert.Equal(true, kvp.Value); });
kvp =>
{
Assert.Equal("IsPublic", kvp.Key);
var value = Assert.IsType<bool>(kvp.Value);
Assert.True(value);
});
}
[Fact]
@ -290,8 +304,18 @@ namespace Microsoft.AspNetCore.Routing.Tests
Assert.IsType<RouteValueDictionary.PropertyStorage>(dict._storage);
Assert.Collection(
dict.OrderBy(kvp => kvp.Key),
kvp => { Assert.Equal("DerivedProperty", kvp.Key); Assert.Equal(false, kvp.Value); },
kvp => { Assert.Equal("TotallySweetProperty", kvp.Key); Assert.Equal(true, kvp.Value); });
kvp =>
{
Assert.Equal("DerivedProperty", kvp.Key);
var value = Assert.IsType<bool>(kvp.Value);
Assert.False(value);
},
kvp =>
{
Assert.Equal("TotallySweetProperty", kvp.Key);
var value = Assert.IsType<bool>(kvp.Value);
Assert.True(value);
});
}
[Fact]

View File

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

View File

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

View File

@ -34,11 +34,10 @@ namespace Microsoft.AspNetCore.Routing.Tests
[InlineData("Apr 5 2009 11:45:00 PM", true)]
[InlineData("April 5 2009 11:45:00 PM", true)]
[InlineData("12/25/2009 11:45:00 PM", true)]
[InlineData("11:45:00 PM", true)]
[InlineData("2009-05-12T11:45:00Z", true)]
[InlineData("not-parseable-as-date", false)]
[InlineData(false, false)]
[MemberData("GetDateTimeObject")]
[MemberData(nameof(GetDateTimeObject))]
public void DateTimeRouteConstraint(object parameterValue, bool expected)
{
// Arrange

View File

@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Routing.Tests
[InlineData("1.79769313486232E+300", false)]
[InlineData("not-parseable-as-decimal", false)]
[InlineData(false, false)]
[MemberData("GetDecimalObject")]
[MemberData(nameof(GetDecimalObject))]
public void DecimalRouteConstraint_ApplyConstraint(object parameterValue, bool expected)
{
// Arrange

View File

@ -917,7 +917,7 @@ namespace Microsoft.AspNetCore.Routing.Tests
// Assert
Assert.Equal("p1", templatePart.Name);
Assert.Equal(templatePart.DefaultValue, "123-456-7890");
Assert.Equal("123-456-7890", templatePart.DefaultValue);
Assert.False(templatePart.IsOptional);
var constraint = Assert.Single(templatePart.InlineConstraints);

View File

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

View File

@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.Routing
Assert.IsType<OptionalRouteConstraint>(Assert.Single(result).Value);
var optionalConstraint = (OptionalRouteConstraint)result.First().Value;
var compositeConstraint = Assert.IsType<CompositeRouteConstraint>(optionalConstraint.InnerConstraint); ;
Assert.Equal(compositeConstraint.Constraints.Count(), 2);
Assert.Equal(2, compositeConstraint.Constraints.Count());
Assert.Single(compositeConstraint.Constraints, c => c is MinLengthRouteConstraint);
Assert.Single(compositeConstraint.Constraints, c => c is AlphaRouteConstraint);

View File

@ -324,7 +324,7 @@ namespace Microsoft.AspNetCore.Routing
var innerConstraint = ((OptionalRouteConstraint)route.Constraints["id"]).InnerConstraint;
Assert.IsType<CompositeRouteConstraint>(innerConstraint);
var compositeConstraint = (CompositeRouteConstraint)innerConstraint;
Assert.Equal(compositeConstraint.Constraints.Count<IRouteConstraint>(), 2);
Assert.Equal(2, compositeConstraint.Constraints.Count<IRouteConstraint>());
Assert.Single(compositeConstraint.Constraints, c => c is IntRouteConstraint);
Assert.Single(compositeConstraint.Constraints, c => c is RangeRouteConstraint);
@ -720,7 +720,7 @@ namespace Microsoft.AspNetCore.Routing
}
[Theory]
[MemberData("DataTokensTestData")]
[MemberData(nameof(DataTokensTestData))]
public void GetVirtualPath_ReturnsDataTokens_WhenTargetReturnsVirtualPathData(
RouteValueDictionary dataTokens)
{
@ -764,7 +764,7 @@ namespace Microsoft.AspNetCore.Routing
}
[Theory]
[MemberData("DataTokensTestData")]
[MemberData(nameof(DataTokensTestData))]
public void GetVirtualPath_ReturnsDataTokens_WhenTargetReturnsNullVirtualPathData(
RouteValueDictionary dataTokens)
{
@ -1529,7 +1529,7 @@ namespace Microsoft.AspNetCore.Routing
}
[Theory]
[MemberData("DataTokens")]
[MemberData(nameof(DataTokens))]
public void RegisteringRoute_WithDataTokens_AbleToAddTheRoute(object dataToken,
IDictionary<string, object> expectedDictionary)
{

View File

@ -403,6 +403,7 @@ namespace Microsoft.AspNetCore.Routing.Template.Tests
Assert.Equal<RouteTemplate>(expected, actual, new TemplateEqualityComparer());
}
[Fact(Skip = "Fails")]
public void Parse_ComplexSegment_OptionalParameterFollowingPeriod_LastSegment()
{
// Arrange
@ -544,6 +545,7 @@ namespace Microsoft.AspNetCore.Routing.Template.Tests
+ Environment.NewLine + "Parameter name: routeTemplate");
}
[Theory(Skip = "Skipped because it causes the test framework to crash")]
[InlineData("{p1}-{p2?}", "-")]
[InlineData("{p1}..{p2?}", "..")]
[InlineData("..{p2?}", "..")]

View File

@ -1678,7 +1678,7 @@ namespace Microsoft.AspNetCore.Routing.Tree
}
[Theory]
[MemberData("OptionalParamValues")]
[MemberData(nameof(OptionalParamValues))]
public void TreeRouter_GenerateLink_Match_WithOptionalParameters(
string template,
object ambientValues,