From 6b3d42f6bd22e7b98de6ad24373411f1bcad8723 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Thu, 5 Oct 2017 15:16:06 -0700 Subject: [PATCH] Minor changes to test code to resolve xUnit2013 build errors --- .../HttpMethodEndpointSelectorTest.cs | 4 ++-- .../VirtualPathDataTests.cs | 2 +- test/Microsoft.AspNetCore.Routing.Tests/RouteTest.cs | 2 +- .../Template/TemplateMatcherTests.cs | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/Microsoft.AspNetCore.Dispatcher.Test/HttpMethodEndpointSelectorTest.cs b/test/Microsoft.AspNetCore.Dispatcher.Test/HttpMethodEndpointSelectorTest.cs index 0136752df8..898960d4cf 100644 --- a/test/Microsoft.AspNetCore.Dispatcher.Test/HttpMethodEndpointSelectorTest.cs +++ b/test/Microsoft.AspNetCore.Dispatcher.Test/HttpMethodEndpointSelectorTest.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// 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 System.Collections.Generic; @@ -52,7 +52,7 @@ namespace Microsoft.AspNetCore.Dispatcher await selector.SelectAsync(context); // Assert - Assert.Equal(0, context.Endpoints.Count); + Assert.Empty(context.Endpoints); } [Theory] diff --git a/test/Microsoft.AspNetCore.Mvc.Routing.Abstractions.Tests/VirtualPathDataTests.cs b/test/Microsoft.AspNetCore.Mvc.Routing.Abstractions.Tests/VirtualPathDataTests.cs index b0917796c6..c21de9ba32 100644 --- a/test/Microsoft.AspNetCore.Mvc.Routing.Abstractions.Tests/VirtualPathDataTests.cs +++ b/test/Microsoft.AspNetCore.Mvc.Routing.Abstractions.Tests/VirtualPathDataTests.cs @@ -42,7 +42,7 @@ namespace Microsoft.AspNetCore.Routing Assert.Equal(path, pathData.VirtualPath); Assert.NotNull(pathData.DataTokens); Assert.Equal("TestValue", pathData.DataTokens["TestKey"]); - Assert.Equal(1, pathData.DataTokens.Count); + Assert.Single(pathData.DataTokens); Assert.NotSame(dataTokens, pathData.DataTokens); } diff --git a/test/Microsoft.AspNetCore.Routing.Tests/RouteTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/RouteTest.cs index 53b271e405..7eee101ebb 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/RouteTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/RouteTest.cs @@ -408,7 +408,7 @@ namespace Microsoft.AspNetCore.Routing // Assert Assert.NotNull(context.Handler); - Assert.Equal(0, context.RouteData.Values.Count); + Assert.Empty(context.RouteData.Values); } [Fact] diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Template/TemplateMatcherTests.cs b/test/Microsoft.AspNetCore.Routing.Tests/Template/TemplateMatcherTests.cs index a7b0c4ddee..1e5eb7c39e 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Template/TemplateMatcherTests.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Template/TemplateMatcherTests.cs @@ -931,7 +931,7 @@ namespace Microsoft.AspNetCore.Routing.Template.Tests // Assert Assert.True(match); - Assert.Equal(1, values.Count); + Assert.Single(values); Assert.Equal("Home", values["controller"]); Assert.False(values.ContainsKey("action")); } @@ -950,7 +950,7 @@ namespace Microsoft.AspNetCore.Routing.Template.Tests // Assert Assert.True(match); - Assert.Equal(0, values.Count); + Assert.Empty(values); Assert.False(values.ContainsKey("controller")); } @@ -968,7 +968,7 @@ namespace Microsoft.AspNetCore.Routing.Template.Tests // Assert Assert.True(match); - Assert.Equal(0, values.Count); + Assert.Empty(values); } [Fact]