diff --git a/test/Microsoft.AspNet.Routing.Tests/ConstraintMatcherTest.cs b/test/Microsoft.AspNet.Routing.Tests/ConstraintMatcherTest.cs index 00254ff874..b3383428de 100644 --- a/test/Microsoft.AspNet.Routing.Tests/ConstraintMatcherTest.cs +++ b/test/Microsoft.AspNet.Routing.Tests/ConstraintMatcherTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using Microsoft.AspNet.Http; #if ASPNET50 using Microsoft.AspNet.Routing.Logging; +using Microsoft.AspNet.Testing.Logging; using Moq; #endif using Xunit; diff --git a/test/Microsoft.AspNet.Routing.Tests/Logging/BeginScopeContext.cs b/test/Microsoft.AspNet.Routing.Tests/Logging/BeginScopeContext.cs deleted file mode 100644 index 456d1c1a6d..0000000000 --- a/test/Microsoft.AspNet.Routing.Tests/Logging/BeginScopeContext.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.AspNet.Routing -{ - public class BeginScopeContext - { - public object Scope { get; set; } - - public string LoggerName { get; set; } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Routing.Tests/Logging/TestLogger.cs b/test/Microsoft.AspNet.Routing.Tests/Logging/TestLogger.cs deleted file mode 100644 index 2b8de04824..0000000000 --- a/test/Microsoft.AspNet.Routing.Tests/Logging/TestLogger.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Routing -{ - public class TestLogger : ILogger - { - private object _scope; - private TestSink _sink; - private string _name; - private bool _enabled; - - public TestLogger(string name, TestSink sink, bool enabled) - { - _sink = sink; - _name = name; - _enabled = enabled; - } - - public string Name { get; set; } - - public IDisposable BeginScope(object state) - { - _scope = state; - - _sink.Begin(new BeginScopeContext() - { - LoggerName = _name, - Scope = state, - }); - - return NullDisposable.Instance; - } - - public void Write(LogLevel logLevel, int eventId, object state, Exception exception, Func formatter) - { - _sink.Write(new WriteContext() - { - LogLevel = logLevel, - EventId = eventId, - State = state, - Exception = exception, - Formatter = formatter, - LoggerName = _name, - Scope = _scope - }); - } - - public bool IsEnabled(LogLevel logLevel) - { - return _enabled; - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Routing.Tests/Logging/TestLoggerFactory.cs b/test/Microsoft.AspNet.Routing.Tests/Logging/TestLoggerFactory.cs deleted file mode 100644 index 1f9b90baab..0000000000 --- a/test/Microsoft.AspNet.Routing.Tests/Logging/TestLoggerFactory.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.Framework.Logging; - -namespace Microsoft.AspNet.Routing -{ - public class TestLoggerFactory : ILoggerFactory - { - private TestSink _sink; - private bool _enabled; - - public LogLevel MinimumLevel { get; set; } - - public TestLoggerFactory(TestSink sink, bool enabled) - { - _sink = sink; - _enabled = enabled; - } - - public ILogger Create(string name) - { - return new TestLogger(name, _sink, _enabled); - } - - public void AddProvider(ILoggerProvider provider) - { - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Routing.Tests/Logging/TestSink.cs b/test/Microsoft.AspNet.Routing.Tests/Logging/TestSink.cs deleted file mode 100644 index e01a3b869a..0000000000 --- a/test/Microsoft.AspNet.Routing.Tests/Logging/TestSink.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; - -namespace Microsoft.AspNet.Routing -{ - public class TestSink - { - public TestSink( - Func writeEnabled = null, - Func beginEnabled = null) - { - WriteEnabled = writeEnabled; - BeginEnabled = beginEnabled; - - Scopes = new List(); - Writes = new List(); - } - - public Func WriteEnabled { get; set; } - - public Func BeginEnabled { get; set; } - - public List Scopes { get; set; } - - public List Writes { get; set; } - - public void Write(WriteContext context) - { - if (WriteEnabled == null || WriteEnabled(context)) - { - Writes.Add(context); - } - } - - public void Begin(BeginScopeContext context) - { - if (BeginEnabled == null || BeginEnabled(context)) - { - Scopes.Add(context); - } - } - - public static bool EnableWithTypeName(WriteContext context) - { - return context.LoggerName.Equals(typeof(T).FullName); - } - - public static bool EnableWithTypeName(BeginScopeContext context) - { - return context.LoggerName.Equals(typeof(T).FullName); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Routing.Tests/RouteCollectionTest.cs b/test/Microsoft.AspNet.Routing.Tests/RouteCollectionTest.cs index fc64702a99..5927ce0fd7 100644 --- a/test/Microsoft.AspNet.Routing.Tests/RouteCollectionTest.cs +++ b/test/Microsoft.AspNet.Routing.Tests/RouteCollectionTest.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Microsoft.AspNet.Http; using Microsoft.AspNet.Routing.Logging; using Microsoft.AspNet.Routing.Template; +using Microsoft.AspNet.Testing.Logging; using Microsoft.Framework.Logging; using Microsoft.Framework.OptionsModel; using Moq; diff --git a/test/Microsoft.AspNet.Routing.Tests/RouterMiddlewareTest.cs b/test/Microsoft.AspNet.Routing.Tests/RouterMiddlewareTest.cs index faa8cad5c7..69bf4311a8 100644 --- a/test/Microsoft.AspNet.Routing.Tests/RouterMiddlewareTest.cs +++ b/test/Microsoft.AspNet.Routing.Tests/RouterMiddlewareTest.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http.Core; using Microsoft.AspNet.Routing.Logging; +using Microsoft.AspNet.Testing.Logging; using Xunit; namespace Microsoft.AspNet.Routing diff --git a/test/Microsoft.AspNet.Routing.Tests/Template/TemplateRouteTest.cs b/test/Microsoft.AspNet.Routing.Tests/Template/TemplateRouteTest.cs index 1c5ea0db77..4ea56b96b7 100644 --- a/test/Microsoft.AspNet.Routing.Tests/Template/TemplateRouteTest.cs +++ b/test/Microsoft.AspNet.Routing.Tests/Template/TemplateRouteTest.cs @@ -11,6 +11,7 @@ using Microsoft.AspNet.Http; using Microsoft.AspNet.Routing.Constraints; using Microsoft.AspNet.Routing.Logging; using Microsoft.AspNet.Testing; +using Microsoft.AspNet.Testing.Logging; using Microsoft.Framework.Logging; using Microsoft.AspNet.WebUtilities; using Moq; diff --git a/test/Microsoft.AspNet.Routing.Tests/project.json b/test/Microsoft.AspNet.Routing.Tests/project.json index 195b059c12..3759eae157 100644 --- a/test/Microsoft.AspNet.Routing.Tests/project.json +++ b/test/Microsoft.AspNet.Routing.Tests/project.json @@ -6,10 +6,11 @@ "Microsoft.AspNet.Http.Core": "1.0.0-*", "Microsoft.AspNet.Routing": "1.0.0-*", "Microsoft.AspNet.Testing": "1.0.0-*", + "Microsoft.AspNet.Testing.Logging": "1.0.0-*", "xunit.runner.kre": "1.0.0-*" }, "frameworks": { - "aspnetcore50": {}, + "aspnetcore50": { }, "aspnet50": { "dependencies": { "Moq": "4.2.1312.1622" @@ -19,4 +20,4 @@ "commands": { "test": "xunit.runner.kre" } -} +} \ No newline at end of file