From 7113e542671630a7e23221a1c15e4f955f1b8856 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 12 Apr 2018 16:17:04 -0700 Subject: [PATCH] Update usage of TestSink --- .../ConstraintMatcherTest.cs | 4 ++-- .../RouteCollectionTest.cs | 20 ------------------- .../RouterMiddlewareTest.cs | 4 ++-- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/test/Microsoft.AspNetCore.Routing.Tests/ConstraintMatcherTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/ConstraintMatcherTest.cs index b3888a627d..4d9b436e81 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/ConstraintMatcherTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/ConstraintMatcherTest.cs @@ -60,8 +60,8 @@ namespace Microsoft.AspNetCore.Routing // Assert Assert.Empty(sink.Scopes); - Assert.Single(sink.Writes); - Assert.Equal(expectedMessage, sink.Writes[0].State?.ToString()); + var write = Assert.Single(sink.Writes); + Assert.Equal(expectedMessage, write.State?.ToString()); } [Fact] diff --git a/test/Microsoft.AspNetCore.Routing.Tests/RouteCollectionTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/RouteCollectionTest.cs index b5daf39586..c0d5a0187a 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/RouteCollectionTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/RouteCollectionTest.cs @@ -460,26 +460,6 @@ namespace Microsoft.AspNetCore.Routing } } - private static async Task SetUp(bool enabled, bool handled) - { - // Arrange - var sink = new TestSink( - TestSink.EnableWithTypeName, - TestSink.EnableWithTypeName); - var loggerFactory = new TestLoggerFactory(sink, enabled); - - var routes = new RouteCollection(); - var route = CreateRoute(accept: handled); - routes.Add(route.Object); - - var context = CreateRouteContext("/Cool", loggerFactory); - - // Act - await routes.RouteAsync(context); - - return sink; - } - private static RouteCollection GetRouteCollectionWithNamedRoutes(IEnumerable routeNames) { var routes = new RouteCollection(); diff --git a/test/Microsoft.AspNetCore.Routing.Tests/RouterMiddlewareTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/RouterMiddlewareTest.cs index eed7f8d58b..464a389b44 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/RouterMiddlewareTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/RouterMiddlewareTest.cs @@ -40,8 +40,8 @@ namespace Microsoft.AspNetCore.Routing // Assert Assert.Empty(sink.Scopes); - Assert.Single(sink.Writes); - Assert.Equal(expectedMessage, sink.Writes[0].State?.ToString()); + var write = Assert.Single(sink.Writes); + Assert.Equal(expectedMessage, write.State?.ToString()); } [Fact]