Browse Source

Relocate Logging.Testing to AspNetCore.Testing

John Luo 6 years ago
parent
commit
fcb23108b6
61 changed files with 21 additions and 113 deletions
  1. 2 2
      eng/Build.props
  2. 1 2
      eng/ProjectReferences.props
  3. 1 1
      src/Components/test/testassets/TestServer/Components.TestServer.csproj
  4. 0 1
      src/Hosting/Server.IntegrationTesting/src/Microsoft.AspNetCore.Server.IntegrationTesting.csproj
  5. 0 0
      src/Logging.AzureAppServices/Directory.Build.props
  6. 0 0
      src/Logging.AzureAppServices/src/AzureAppServicesLoggerFactoryExtensions.cs
  7. 0 0
      src/Logging.AzureAppServices/src/AzureBlobLoggerOptions.cs
  8. 0 0
      src/Logging.AzureAppServices/src/AzureFileLoggerOptions.cs
  9. 0 0
      src/Logging.AzureAppServices/src/BatchLoggerConfigureOptions.cs
  10. 0 0
      src/Logging.AzureAppServices/src/BatchingLogger.cs
  11. 0 0
      src/Logging.AzureAppServices/src/BatchingLoggerOptions.cs
  12. 0 0
      src/Logging.AzureAppServices/src/BatchingLoggerProvider.cs
  13. 0 0
      src/Logging.AzureAppServices/src/BlobAppendReferenceWrapper.cs
  14. 0 0
      src/Logging.AzureAppServices/src/BlobLoggerConfigureOptions.cs
  15. 0 0
      src/Logging.AzureAppServices/src/BlobLoggerProvider.cs
  16. 0 0
      src/Logging.AzureAppServices/src/ConfigurationBasedLevelSwitcher.cs
  17. 0 0
      src/Logging.AzureAppServices/src/FileLoggerConfigureOptions.cs
  18. 0 0
      src/Logging.AzureAppServices/src/FileLoggerProvider.cs
  19. 0 0
      src/Logging.AzureAppServices/src/ICloudAppendBlob.cs
  20. 0 0
      src/Logging.AzureAppServices/src/IWebAppContext.cs
  21. 0 0
      src/Logging.AzureAppServices/src/LogMessage.cs
  22. 0 0
      src/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj
  23. 0 0
      src/Logging.AzureAppServices/src/Properties/AssemblyInfo.cs
  24. 0 0
      src/Logging.AzureAppServices/src/SiteConfigurationProvider.cs
  25. 0 0
      src/Logging.AzureAppServices/src/WebAppContext.cs
  26. 0 0
      src/Logging.AzureAppServices/test/AzureAppendBlobTests.cs
  27. 0 0
      src/Logging.AzureAppServices/test/AzureBlobSinkTests.cs
  28. 0 0
      src/Logging.AzureAppServices/test/AzureDiagnosticsConfigurationProviderTests.cs
  29. 0 0
      src/Logging.AzureAppServices/test/BatchingLoggerProviderTests.cs
  30. 0 0
      src/Logging.AzureAppServices/test/ConfigureOptionsTests.cs
  31. 0 0
      src/Logging.AzureAppServices/test/FileLoggerTests.cs
  32. 0 0
      src/Logging.AzureAppServices/test/LoggerBuilderExtensionsTests.cs
  33. 0 0
      src/Logging.AzureAppServices/test/ManualIntervalControl.cs
  34. 0 0
      src/Logging.AzureAppServices/test/Microsoft.Extensions.Logging.AzureAppServices.Tests.csproj
  35. 0 0
      src/Logging.AzureAppServices/test/OptionsWrapperMonitor.cs
  36. 0 0
      src/Logging.AzureAppServices/test/TestBlobSink.cs
  37. 0 0
      src/Logging.AzureAppServices/test/TestFileLoggerProvider.cs
  38. 0 0
      src/Logging.AzureAppServices/test/WebConfigurationLevelSwitchTests.cs
  39. 0 36
      src/Logging/Logging.Testing/src/Microsoft.Extensions.Logging.Testing.csproj
  40. 0 15
      src/Logging/Logging.Testing/test/Microsoft.Extensions.Logging.Testing.Tests.csproj
  41. 0 8
      src/Logging/Logging.Testing/test/Properties/AssemblyInfo.cs
  42. 0 37
      src/Logging/Logging.Testing/test/TestTestOutputHelper.cs
  43. 1 1
      src/Servers/IIS/IIS/test/testassets/IIS.Common.TestLib/IIS.Common.TestLib.csproj
  44. 0 2
      src/Servers/Kestrel/Directory.Build.props
  45. 0 1
      src/SignalR/Directory.Build.props
  46. 0 1
      src/SignalR/common/testassets/Tests.Utils/Microsoft.AspNetCore.SignalR.Tests.Utils.csproj
  47. 0 0
      src/Testing/src/Logging/BeginScopeContext.cs
  48. 0 0
      src/Testing/src/Logging/ITestSink.cs
  49. 0 0
      src/Testing/src/Logging/LogLevelAttribute.cs
  50. 0 0
      src/Testing/src/Logging/LogValuesAssert.cs
  51. 0 0
      src/Testing/src/Logging/TestLogger.cs
  52. 0 0
      src/Testing/src/Logging/TestLoggerFactory.cs
  53. 0 0
      src/Testing/src/Logging/TestLoggerProvider.cs
  54. 0 0
      src/Testing/src/Logging/TestLoggerT.cs
  55. 0 0
      src/Testing/src/Logging/TestSink.cs
  56. 0 0
      src/Testing/src/Logging/WriteContext.cs
  57. 0 0
      src/Testing/src/Logging/XunitLoggerFactoryExtensions.cs
  58. 0 0
      src/Testing/src/Logging/XunitLoggerProvider.cs
  59. 3 1
      src/Testing/src/Microsoft.AspNetCore.Testing.csproj
  60. 0 0
      src/Testing/test/LogValuesAssertTest.cs
  61. 13 5
      src/Testing/test/XunitLoggerProviderTest.cs

+ 2 - 2
eng/Build.props

@@ -152,7 +152,7 @@
                           $(RepoRoot)src\SiteExtensions\LoggingAggregate\test\**\*.csproj;
                           $(RepoRoot)src\Shared\**\*.*proj;
                           $(RepoRoot)src\Tools\**\*.*proj;
-                          $(RepoRoot)src\Logging\**\src\*.csproj;
+                          $(RepoRoot)src\Logging.AzureAppServices\**\src\*.csproj;
                           $(RepoRoot)src\Middleware\**\*.csproj;
                           $(RepoRoot)src\Razor\**\*.*proj;
                           $(RepoRoot)src\Mvc\**\*.*proj;
@@ -192,7 +192,7 @@
                           $(RepoRoot)src\Security\**\src\*.csproj;
                           $(RepoRoot)src\SiteExtensions\**\src\*.csproj;
                           $(RepoRoot)src\Tools\**\src\*.csproj;
-                          $(RepoRoot)src\Logging\**\src\*.csproj;
+                          $(RepoRoot)src\Logging.AzureAppServices\**\src\*.csproj;
                           $(RepoRoot)src\Middleware\**\src\*.csproj;
                           $(RepoRoot)src\Razor\**\src\*.csproj;
                           $(RepoRoot)src\Mvc\**\src\*.csproj;

+ 1 - 2
eng/ProjectReferences.props

@@ -32,8 +32,7 @@
     <ProjectReferenceProvider Include="Microsoft.Extensions.ApiDescription.Server" ProjectPath="$(RepoRoot)src\Tools\Extensions.ApiDescription.Server\src\Microsoft.Extensions.ApiDescription.Server.csproj"  />
     <ProjectReferenceProvider Include="Microsoft.AspNetCore.DeveloperCertificates.XPlat" ProjectPath="$(RepoRoot)src\Tools\FirstRunCertGenerator\src\Microsoft.AspNetCore.DeveloperCertificates.XPlat.csproj"  />
     <ProjectReferenceProvider Include="GetDocument.Insider" ProjectPath="$(RepoRoot)src\Tools\GetDocumentInsider\src\GetDocumentInsider.csproj"  />
-    <ProjectReferenceProvider Include="Microsoft.Extensions.Logging.AzureAppServices" ProjectPath="$(RepoRoot)src\Logging\Logging.AzureAppServices\src\Microsoft.Extensions.Logging.AzureAppServices.csproj"  />
-    <ProjectReferenceProvider Include="Microsoft.Extensions.Logging.Testing" ProjectPath="$(RepoRoot)src\Logging\Logging.Testing\src\Microsoft.Extensions.Logging.Testing.csproj"  />
+    <ProjectReferenceProvider Include="Microsoft.Extensions.Logging.AzureAppServices" ProjectPath="$(RepoRoot)src\Logging.AzureAppServices\src\Microsoft.Extensions.Logging.AzureAppServices.csproj"  />
     <ProjectReferenceProvider Include="Microsoft.AspNetCore.ConcurrencyLimiter" ProjectPath="$(RepoRoot)src\Middleware\ConcurrencyLimiter\src\Microsoft.AspNetCore.ConcurrencyLimiter.csproj"  />
     <ProjectReferenceProvider Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" ProjectPath="$(RepoRoot)src\Middleware\Diagnostics.EntityFrameworkCore\src\Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.csproj"  />
     <ProjectReferenceProvider Include="Microsoft.AspNetCore.HeaderPropagation" ProjectPath="$(RepoRoot)src\Middleware\HeaderPropagation\src\Microsoft.AspNetCore.HeaderPropagation.csproj"  />

+ 1 - 1
src/Components/test/testassets/TestServer/Components.TestServer.csproj

@@ -14,8 +14,8 @@
     <Reference Include="Microsoft.AspNetCore.Mvc" />
     <Reference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" />
     <Reference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" />
+    <Reference Include="Microsoft.AspNetCore.Testing" />
     <Reference Include="Microsoft.Extensions.Hosting" />
-    <Reference Include="Microsoft.Extensions.Logging.Testing" />
   </ItemGroup>
 
   <ItemGroup>

+ 0 - 1
src/Hosting/Server.IntegrationTesting/src/Microsoft.AspNetCore.Server.IntegrationTesting.csproj

@@ -23,7 +23,6 @@
     <Reference Include="Microsoft.Extensions.FileProviders.Embedded" />
     <Reference Include="Microsoft.Extensions.Logging" />
     <Reference Include="Microsoft.Extensions.Logging.Console" />
-    <Reference Include="Microsoft.Extensions.Logging.Testing" />
     <Reference Include="Microsoft.NETCore.Windows.ApiSets" />
     <Reference Include="Serilog.Extensions.Logging" />
     <Reference Include="Serilog.Sinks.File" />

+ 0 - 0
src/Logging/Logging.AzureAppServices/Directory.Build.props → src/Logging.AzureAppServices/Directory.Build.props


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/AzureAppServicesLoggerFactoryExtensions.cs → src/Logging.AzureAppServices/src/AzureAppServicesLoggerFactoryExtensions.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/AzureBlobLoggerOptions.cs → src/Logging.AzureAppServices/src/AzureBlobLoggerOptions.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/AzureFileLoggerOptions.cs → src/Logging.AzureAppServices/src/AzureFileLoggerOptions.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/BatchLoggerConfigureOptions.cs → src/Logging.AzureAppServices/src/BatchLoggerConfigureOptions.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/BatchingLogger.cs → src/Logging.AzureAppServices/src/BatchingLogger.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/BatchingLoggerOptions.cs → src/Logging.AzureAppServices/src/BatchingLoggerOptions.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/BatchingLoggerProvider.cs → src/Logging.AzureAppServices/src/BatchingLoggerProvider.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/BlobAppendReferenceWrapper.cs → src/Logging.AzureAppServices/src/BlobAppendReferenceWrapper.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/BlobLoggerConfigureOptions.cs → src/Logging.AzureAppServices/src/BlobLoggerConfigureOptions.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/BlobLoggerProvider.cs → src/Logging.AzureAppServices/src/BlobLoggerProvider.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/ConfigurationBasedLevelSwitcher.cs → src/Logging.AzureAppServices/src/ConfigurationBasedLevelSwitcher.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/FileLoggerConfigureOptions.cs → src/Logging.AzureAppServices/src/FileLoggerConfigureOptions.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/FileLoggerProvider.cs → src/Logging.AzureAppServices/src/FileLoggerProvider.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/ICloudAppendBlob.cs → src/Logging.AzureAppServices/src/ICloudAppendBlob.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/IWebAppContext.cs → src/Logging.AzureAppServices/src/IWebAppContext.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/LogMessage.cs → src/Logging.AzureAppServices/src/LogMessage.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj → src/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/Properties/AssemblyInfo.cs → src/Logging.AzureAppServices/src/Properties/AssemblyInfo.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/SiteConfigurationProvider.cs → src/Logging.AzureAppServices/src/SiteConfigurationProvider.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/src/WebAppContext.cs → src/Logging.AzureAppServices/src/WebAppContext.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/test/AzureAppendBlobTests.cs → src/Logging.AzureAppServices/test/AzureAppendBlobTests.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/test/AzureBlobSinkTests.cs → src/Logging.AzureAppServices/test/AzureBlobSinkTests.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/test/AzureDiagnosticsConfigurationProviderTests.cs → src/Logging.AzureAppServices/test/AzureDiagnosticsConfigurationProviderTests.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/test/BatchingLoggerProviderTests.cs → src/Logging.AzureAppServices/test/BatchingLoggerProviderTests.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/test/ConfigureOptionsTests.cs → src/Logging.AzureAppServices/test/ConfigureOptionsTests.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/test/FileLoggerTests.cs → src/Logging.AzureAppServices/test/FileLoggerTests.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/test/LoggerBuilderExtensionsTests.cs → src/Logging.AzureAppServices/test/LoggerBuilderExtensionsTests.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/test/ManualIntervalControl.cs → src/Logging.AzureAppServices/test/ManualIntervalControl.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/test/Microsoft.Extensions.Logging.AzureAppServices.Tests.csproj → src/Logging.AzureAppServices/test/Microsoft.Extensions.Logging.AzureAppServices.Tests.csproj


+ 0 - 0
src/Logging/Logging.AzureAppServices/test/OptionsWrapperMonitor.cs → src/Logging.AzureAppServices/test/OptionsWrapperMonitor.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/test/TestBlobSink.cs → src/Logging.AzureAppServices/test/TestBlobSink.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/test/TestFileLoggerProvider.cs → src/Logging.AzureAppServices/test/TestFileLoggerProvider.cs


+ 0 - 0
src/Logging/Logging.AzureAppServices/test/WebConfigurationLevelSwitchTests.cs → src/Logging.AzureAppServices/test/WebConfigurationLevelSwitchTests.cs


+ 0 - 36
src/Logging/Logging.Testing/src/Microsoft.Extensions.Logging.Testing.csproj

@@ -1,36 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <Description>Helpers for writing tests that use Microsoft.Extensions.Logging. Contains null implementations of the abstractions that do nothing, as well as test implementations that are observable.</Description>
-    <TargetFrameworks>netstandard2.0;net472</TargetFrameworks>
-    <NoWarn>$(NoWarn);CS1591</NoWarn>
-    <PackageTags>$(PackageTags);testing</PackageTags>
-    <!-- This is actually a library for test projects, not a test project. -->
-    <IsUnitTestProject>false</IsUnitTestProject>
-    <IsShipping>false</IsShipping>
-    <ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <InternalsVisibleTo Include="Microsoft.Extensions.Logging.Testing.Tests" />
-  </ItemGroup>
-
-  <ItemGroup>
-    <Reference Include="Microsoft.Extensions.DependencyInjection" />
-    <Reference Include="Microsoft.Extensions.Logging.Console" />
-    <Reference Include="Microsoft.Extensions.Logging" />
-
-    <!--
-      This intentionally does not reference 'xunit', 'xunit.core', or any runner packages.
-      XUnit recommends only using xunit.extensibility.*, xunit.assert, and xunit.abstractions for packages which "extend" xunit.
-      This allows consumers to decide which type of xunit runner they want to use to run these tests,
-      and avoids problems with `dotnet pack`.
-
-      See https://xunit.github.io/docs/nuget-packages and the special note in https://xunit.github.io/releases/2.3.
-    -->
-    <Reference Include="xunit.abstractions" />
-    <Reference Include="xunit.assert" />
-    <Reference Include="xunit.extensibility.execution" />
-  </ItemGroup>
-
-</Project>

+ 0 - 15
src/Logging/Logging.Testing/test/Microsoft.Extensions.Logging.Testing.Tests.csproj

@@ -1,15 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFrameworks>$(DefaultNetCoreTargetFramework);net472</TargetFrameworks>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
-    <Reference Include="Microsoft.Extensions.DependencyInjection" />
-    <Reference Include="Microsoft.Extensions.Logging.Abstractions" />
-    <Reference Include="Microsoft.Extensions.Logging.Testing" />
-    <Reference Include="Microsoft.Extensions.Logging" />
-    <Reference Include="Microsoft.Extensions.Primitives" />
-    <ProjectReference Include="../../test/Microsoft.Extensions.Logging.Tests.csproj" />
-  </ItemGroup>
-</Project>

+ 0 - 8
src/Logging/Logging.Testing/test/Properties/AssemblyInfo.cs

@@ -1,8 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Logging.Testing;
-
-[assembly: LogLevel(LogLevel.Trace)]

+ 0 - 37
src/Logging/Logging.Testing/test/TestTestOutputHelper.cs

@@ -1,37 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Text;
-using Xunit.Abstractions;
-
-namespace Microsoft.Extensions.Logging.Testing.Tests
-{
-    public class TestTestOutputHelper : ITestOutputHelper
-    {
-        private StringBuilder _output = new StringBuilder();
-
-        public bool Throw { get; set; }
-
-        public string Output => _output.ToString();
-
-        public void WriteLine(string message)
-        {
-            if (Throw)
-            {
-                throw new Exception("Boom!");
-            }
-            _output.AppendLine(message);
-        }
-
-        public void WriteLine(string format, params object[] args)
-        {
-            if (Throw)
-            {
-                throw new Exception("Boom!");
-            }
-            _output.AppendLine(string.Format(format, args));
-        }
-    }
-}

+ 1 - 1
src/Servers/IIS/IIS/test/testassets/IIS.Common.TestLib/IIS.Common.TestLib.csproj

@@ -7,8 +7,8 @@
   <ItemGroup>
     <ProjectReference Include="$(RepoRoot)src\Servers\IIS\IntegrationTesting.IIS\src\Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj" />
     <Reference Include="Microsoft.AspNetCore.Hosting" />
+    <Reference Include="Microsoft.AspNetCore.Testing" />
     <Reference Include="Microsoft.Extensions.Logging" />
-    <Reference Include="Microsoft.Extensions.Logging.Testing" />
     <Reference Include="System.Diagnostics.EventLog" />
   </ItemGroup>
 

+ 0 - 2
src/Servers/Kestrel/Directory.Build.props

@@ -20,7 +20,5 @@
 
   <ItemGroup Condition=" '$(IsTestProject)' == 'true' ">
     <None Include="$(MSBuildThisFileDirectory)xunit.runner.json" Link="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
-
-    <Reference Include="Microsoft.Extensions.Logging.Testing" />
   </ItemGroup>
 </Project>

+ 0 - 1
src/SignalR/Directory.Build.props

@@ -21,7 +21,6 @@
     <Content Include="$(MSBuildThisFileDirectory)xunit.runner.json" Link="xunit.runner.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Reference Include="Microsoft.Extensions.Logging.Testing" />
   </ItemGroup>
 
 </Project>

+ 0 - 1
src/SignalR/common/testassets/Tests.Utils/Microsoft.AspNetCore.SignalR.Tests.Utils.csproj

@@ -21,7 +21,6 @@
     <Reference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" />
     <Reference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" />
     <Reference Include="Microsoft.AspNetCore.Testing" />
-    <Reference Include="Microsoft.Extensions.Logging.Testing" />
     <!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
     <Reference Include="Microsoft.AspNetCore.SignalR.Common" />
 

+ 0 - 0
src/Logging/Logging.Testing/src/BeginScopeContext.cs → src/Testing/src/Logging/BeginScopeContext.cs


+ 0 - 0
src/Logging/Logging.Testing/src/ITestSink.cs → src/Testing/src/Logging/ITestSink.cs


+ 0 - 0
src/Logging/Logging.Testing/src/LogLevelAttribute.cs → src/Testing/src/Logging/LogLevelAttribute.cs


+ 0 - 0
src/Logging/Logging.Testing/src/LogValuesAssert.cs → src/Testing/src/Logging/LogValuesAssert.cs


+ 0 - 0
src/Logging/Logging.Testing/src/TestLogger.cs → src/Testing/src/Logging/TestLogger.cs


+ 0 - 0
src/Logging/Logging.Testing/src/TestLoggerFactory.cs → src/Testing/src/Logging/TestLoggerFactory.cs


+ 0 - 0
src/Logging/Logging.Testing/src/TestLoggerProvider.cs → src/Testing/src/Logging/TestLoggerProvider.cs


+ 0 - 0
src/Logging/Logging.Testing/src/TestLoggerT.cs → src/Testing/src/Logging/TestLoggerT.cs


+ 0 - 0
src/Logging/Logging.Testing/src/TestSink.cs → src/Testing/src/Logging/TestSink.cs


+ 0 - 0
src/Logging/Logging.Testing/src/WriteContext.cs → src/Testing/src/Logging/WriteContext.cs


+ 0 - 0
src/Logging/Logging.Testing/src/XunitLoggerFactoryExtensions.cs → src/Testing/src/Logging/XunitLoggerFactoryExtensions.cs


+ 0 - 0
src/Logging/Logging.Testing/src/XunitLoggerProvider.cs → src/Testing/src/Logging/XunitLoggerProvider.cs


+ 3 - 1
src/Testing/src/Microsoft.AspNetCore.Testing.csproj

@@ -19,7 +19,9 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Reference Include="Microsoft.Extensions.Logging.Testing" />
+    <Reference Include="Microsoft.Extensions.DependencyInjection" />
+    <Reference Include="Microsoft.Extensions.Logging.Console" />
+    <Reference Include="Microsoft.Extensions.Logging" />
     <Reference Include="Microsoft.Win32.Registry" />
     <Reference Include="Serilog.Extensions.Logging" />
     <Reference Include="Serilog.Sinks.File" />

+ 0 - 0
src/Logging/Logging.Testing/test/LogValuesAssertTest.cs → src/Testing/test/LogValuesAssertTest.cs


+ 13 - 5
src/Logging/Logging.Testing/test/XunitLoggerProviderTest.cs → src/Testing/test/XunitLoggerProviderTest.cs

@@ -4,7 +4,7 @@
 
 using System;
 using System.Text.RegularExpressions;
-using Microsoft.Extensions.Logging.Test;
+using Microsoft.Extensions.DependencyInjection;
 using Xunit;
 
 namespace Microsoft.Extensions.Logging.Testing.Tests
@@ -16,7 +16,7 @@ namespace Microsoft.Extensions.Logging.Testing.Tests
         {
             var testTestOutputHelper = new TestTestOutputHelper();
 
-            var loggerFactory = TestLoggerBuilder.Create(builder => builder
+            var loggerFactory = CreateTestLogger(builder => builder
                 .SetMinimumLevel(LogLevel.Trace)
                 .AddXunit(testTestOutputHelper));
 
@@ -35,7 +35,7 @@ namespace Microsoft.Extensions.Logging.Testing.Tests
         public void LoggerProviderDoesNotWriteLogMessagesBelowMinimumLevel()
         {
             var testTestOutputHelper = new TestTestOutputHelper();
-            var loggerFactory = TestLoggerBuilder.Create(builder => builder
+            var loggerFactory = CreateTestLogger(builder => builder
                 .AddXunit(testTestOutputHelper, LogLevel.Warning));
 
             var logger = loggerFactory.CreateLogger("TestCategory");
@@ -49,7 +49,7 @@ namespace Microsoft.Extensions.Logging.Testing.Tests
         public void LoggerProviderPrependsPrefixToEachLine()
         {
             var testTestOutputHelper = new TestTestOutputHelper();
-            var loggerFactory = TestLoggerBuilder.Create(builder => builder
+            var loggerFactory = CreateTestLogger(builder => builder
                 .AddXunit(testTestOutputHelper));
 
             var logger = loggerFactory.CreateLogger("TestCategory");
@@ -68,7 +68,7 @@ namespace Microsoft.Extensions.Logging.Testing.Tests
         public void LoggerProviderDoesNotThrowIfOutputHelperThrows()
         {
             var testTestOutputHelper = new TestTestOutputHelper();
-            var loggerFactory = TestLoggerBuilder.Create(builder => builder
+            var loggerFactory = CreateTestLogger(builder => builder
 
                 .AddXunit(testTestOutputHelper));
 
@@ -83,5 +83,13 @@ namespace Microsoft.Extensions.Logging.Testing.Tests
         private static readonly Regex TimestampRegex = new Regex(@"\d+-\d+-\d+T\d+:\d+:\d+");
 
         private string MakeConsistent(string input) => TimestampRegex.Replace(input, "TIMESTAMP");
+
+        private static ILoggerFactory CreateTestLogger(Action<ILoggingBuilder> configure)
+        {
+            return new ServiceCollection()
+                .AddLogging(configure)
+                .BuildServiceProvider()
+                .GetRequiredService<ILoggerFactory>();
+        }
     }
 }