diff --git a/src/Testing/ref/Microsoft.AspNetCore.Testing.net46.cs b/src/Testing/ref/Microsoft.AspNetCore.Testing.net46.cs index af28ec60e0..e737371a8c 100644 --- a/src/Testing/ref/Microsoft.AspNetCore.Testing.net46.cs +++ b/src/Testing/ref/Microsoft.AspNetCore.Testing.net46.cs @@ -295,6 +295,7 @@ namespace Microsoft.AspNetCore.Testing public string TestName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } public static string GetAssemblyBaseDirectory(System.Reflection.Assembly assembly, string baseDirectory = null) { throw null; } public static string GetOutputDirectory(System.Reflection.Assembly assembly) { throw null; } + public static bool GetPreserveExistingLogsInOutput(System.Reflection.Assembly assembly) { throw null; } public static string GetTestClassName(System.Type type) { throw null; } public static string GetTestMethodName(System.Reflection.MethodInfo method, object[] arguments) { throw null; } public string GetUniqueFileName(string prefix, string extension) { throw null; } @@ -307,8 +308,9 @@ namespace Microsoft.AspNetCore.Testing [System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=true)] public partial class TestOutputDirectoryAttribute : System.Attribute { - public TestOutputDirectoryAttribute(string targetFramework, string baseDirectory = null) { } + public TestOutputDirectoryAttribute(string preserveExistingLogsInOutput, string targetFramework, string baseDirectory = null) { } public string BaseDirectory { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } + public bool PreserveExistingLogsInOutput { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } public string TargetFramework { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } } [System.ObsoleteAttribute("This API is obsolete and the pattern its usage encouraged should not be used anymore. See https://github.com/aspnet/Extensions/issues/1697 for details.")] diff --git a/src/Testing/ref/Microsoft.AspNetCore.Testing.netstandard2.0.cs b/src/Testing/ref/Microsoft.AspNetCore.Testing.netstandard2.0.cs index af28ec60e0..e737371a8c 100644 --- a/src/Testing/ref/Microsoft.AspNetCore.Testing.netstandard2.0.cs +++ b/src/Testing/ref/Microsoft.AspNetCore.Testing.netstandard2.0.cs @@ -295,6 +295,7 @@ namespace Microsoft.AspNetCore.Testing public string TestName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } public static string GetAssemblyBaseDirectory(System.Reflection.Assembly assembly, string baseDirectory = null) { throw null; } public static string GetOutputDirectory(System.Reflection.Assembly assembly) { throw null; } + public static bool GetPreserveExistingLogsInOutput(System.Reflection.Assembly assembly) { throw null; } public static string GetTestClassName(System.Type type) { throw null; } public static string GetTestMethodName(System.Reflection.MethodInfo method, object[] arguments) { throw null; } public string GetUniqueFileName(string prefix, string extension) { throw null; } @@ -307,8 +308,9 @@ namespace Microsoft.AspNetCore.Testing [System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=true)] public partial class TestOutputDirectoryAttribute : System.Attribute { - public TestOutputDirectoryAttribute(string targetFramework, string baseDirectory = null) { } + public TestOutputDirectoryAttribute(string preserveExistingLogsInOutput, string targetFramework, string baseDirectory = null) { } public string BaseDirectory { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } + public bool PreserveExistingLogsInOutput { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } public string TargetFramework { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } } [System.ObsoleteAttribute("This API is obsolete and the pattern its usage encouraged should not be used anymore. See https://github.com/aspnet/Extensions/issues/1697 for details.")] diff --git a/src/Testing/src/TestFileOutputContext.cs b/src/Testing/src/TestFileOutputContext.cs index 496a1379fb..fb79fd7bf7 100644 --- a/src/Testing/src/TestFileOutputContext.cs +++ b/src/Testing/src/TestFileOutputContext.cs @@ -93,6 +93,12 @@ namespace Microsoft.AspNetCore.Testing return Path.Combine(baseDirectory, assembly.GetName().Name, attribute.TargetFramework); } + public static bool GetPreserveExistingLogsInOutput(Assembly assembly) + { + var attribute = assembly.GetCustomAttributes().OfType().FirstOrDefault(); + return attribute.PreserveExistingLogsInOutput; + } + public static string GetTestClassName(Type type) { var shortNameAttribute = diff --git a/src/Testing/src/TestOutputDirectoryAttribute.cs b/src/Testing/src/TestOutputDirectoryAttribute.cs index 4ae8cea054..b1895c1d92 100644 --- a/src/Testing/src/TestOutputDirectoryAttribute.cs +++ b/src/Testing/src/TestOutputDirectoryAttribute.cs @@ -8,13 +8,15 @@ namespace Microsoft.AspNetCore.Testing [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = true)] public class TestOutputDirectoryAttribute : Attribute { - public TestOutputDirectoryAttribute(string targetFramework, string baseDirectory = null) + public TestOutputDirectoryAttribute(string preserveExistingLogsInOutput, string targetFramework, string baseDirectory = null) { TargetFramework = targetFramework; BaseDirectory = baseDirectory; + PreserveExistingLogsInOutput = bool.Parse(preserveExistingLogsInOutput); } public string BaseDirectory { get; } public string TargetFramework { get; } + public bool PreserveExistingLogsInOutput { get; } } }