diff --git a/test/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/ModuleInit.cs b/test/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/ModuleInit.cs new file mode 100644 index 00000000000..fbb0fb64de5 --- /dev/null +++ b/test/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/ModuleInit.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Runtime.CompilerServices; +using VerifyTests.DiffPlex; + +namespace Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests; + +public static class ModuleInit +{ + [ModuleInitializer] + public static void Init() + { + DerivePathInfo( + (_, _, type, method) => new( + directory: "Snapshots", + typeName: type.Name, + methodName: method.Name)); + + // Customize diff output of verifier + VerifyDiffPlex.Initialize(OutputType.Compact); + } +} diff --git a/test/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/ValidateCommandTests.cs b/test/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/ValidateCommandTests.cs index 33309dd6982..ad8b0809569 100644 --- a/test/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/ValidateCommandTests.cs +++ b/test/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/ValidateCommandTests.cs @@ -9,7 +9,6 @@ namespace Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests { - [Collection("Verify Tests")] public class ValidateCommandTests : TestBase { private readonly ITestOutputHelper _log; diff --git a/test/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/VerifySettingsFixture.cs b/test/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/VerifySettingsFixture.cs deleted file mode 100644 index 79757a88da5..00000000000 --- a/test/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/VerifySettingsFixture.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using VerifyTests.DiffPlex; - -namespace Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests -{ - public class VerifySettingsFixture : IDisposable - { - private static bool s_called; - - public VerifySettingsFixture() - { - if (s_called) - { - return; - } - s_called = true; - DerivePathInfo( - (_, _, type, method) => new( - directory: "Snapshots", - typeName: type.Name, - methodName: method.Name)); - - // Customize diff output of verifier - VerifyDiffPlex.Initialize(OutputType.Compact); - } - - public void Dispose() { } - } -} diff --git a/test/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/VerifyTestCollection.cs b/test/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/VerifyTestCollection.cs deleted file mode 100644 index fb63227639d..00000000000 --- a/test/Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests/VerifyTestCollection.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace Microsoft.TemplateEngine.Authoring.CLI.IntegrationTests -{ - [CollectionDefinition("Verify Tests")] - public class VerifyTestCollection : IClassFixture - { - //intentionally empty - //defines test class collection to share the fixture - //usage [Collection("Verify Tests")] on the test class. - } -} diff --git a/test/Microsoft.TemplateEngine.IDE.IntegrationTests/BasicTests.cs b/test/Microsoft.TemplateEngine.IDE.IntegrationTests/BasicTests.cs index 377d5c86eca..70d5b6c303b 100644 --- a/test/Microsoft.TemplateEngine.IDE.IntegrationTests/BasicTests.cs +++ b/test/Microsoft.TemplateEngine.IDE.IntegrationTests/BasicTests.cs @@ -9,7 +9,6 @@ namespace Microsoft.TemplateEngine.IDE.IntegrationTests { - [Collection("Verify Tests")] public class BasicTests : BootstrapperTestBase, IClassFixture { private readonly PackageManager _packageManager; diff --git a/test/Microsoft.TemplateEngine.IDE.IntegrationTests/End2EndTests.cs b/test/Microsoft.TemplateEngine.IDE.IntegrationTests/End2EndTests.cs index 204228a61a7..d5521d71c2e 100644 --- a/test/Microsoft.TemplateEngine.IDE.IntegrationTests/End2EndTests.cs +++ b/test/Microsoft.TemplateEngine.IDE.IntegrationTests/End2EndTests.cs @@ -10,7 +10,6 @@ namespace Microsoft.TemplateEngine.IDE.IntegrationTests { - [Collection("Verify Tests")] public class End2EndTests : BootstrapperTestBase { [Fact] diff --git a/test/Microsoft.TemplateEngine.IDE.IntegrationTests/ModuleInit.cs b/test/Microsoft.TemplateEngine.IDE.IntegrationTests/ModuleInit.cs new file mode 100644 index 00000000000..12f26c3915d --- /dev/null +++ b/test/Microsoft.TemplateEngine.IDE.IntegrationTests/ModuleInit.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Runtime.CompilerServices; +using VerifyTests.DiffPlex; + +namespace Microsoft.TemplateEngine.IDE.IntegrationTests; + +public static class ModuleInit +{ + [ModuleInitializer] + public static void Init() + { + DerivePathInfo( + (_, _, type, method) => new( + directory: "Approvals", + typeName: type.Name, + methodName: method.Name)); + + // Customize diff output of verifier + VerifyDiffPlex.Initialize(OutputType.Compact); + } +} \ No newline at end of file diff --git a/test/Microsoft.TemplateEngine.IDE.IntegrationTests/ModuleInitializerAttribute.cs b/test/Microsoft.TemplateEngine.IDE.IntegrationTests/ModuleInitializerAttribute.cs new file mode 100644 index 00000000000..6d578b97c6d --- /dev/null +++ b/test/Microsoft.TemplateEngine.IDE.IntegrationTests/ModuleInitializerAttribute.cs @@ -0,0 +1,9 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#if !NET5_0_OR_GREATER +namespace System.Runtime.CompilerServices; + +[AttributeUsage(AttributeTargets.Method, Inherited = false)] +public sealed class ModuleInitializerAttribute : Attribute; +#endif \ No newline at end of file diff --git a/test/Microsoft.TemplateEngine.IDE.IntegrationTests/SnapshotTests.cs b/test/Microsoft.TemplateEngine.IDE.IntegrationTests/SnapshotTests.cs index f6fcb86504f..432801a353e 100644 --- a/test/Microsoft.TemplateEngine.IDE.IntegrationTests/SnapshotTests.cs +++ b/test/Microsoft.TemplateEngine.IDE.IntegrationTests/SnapshotTests.cs @@ -11,7 +11,6 @@ namespace Microsoft.TemplateEngine.IDE.IntegrationTests { - [Collection("Verify Tests")] public class SnapshotTests : TestBase { private readonly ILogger _log; diff --git a/test/Microsoft.TemplateEngine.IDE.IntegrationTests/VerifySettingsFixture.cs b/test/Microsoft.TemplateEngine.IDE.IntegrationTests/VerifySettingsFixture.cs deleted file mode 100644 index f44508b1159..00000000000 --- a/test/Microsoft.TemplateEngine.IDE.IntegrationTests/VerifySettingsFixture.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using VerifyTests.DiffPlex; - -namespace Microsoft.TemplateEngine.IDE.IntegrationTests -{ - public class VerifySettingsFixture : IDisposable - { - private static bool s_called; - - public VerifySettingsFixture() - { - if (s_called) - { - return; - } - s_called = true; - - DerivePathInfo( - (_, _, type, method) => new( - directory: "Approvals", - typeName: type.Name, - methodName: method.Name)); - - // Customize diff output of verifier - VerifyDiffPlex.Initialize(OutputType.Compact); - } - - public void Dispose() { } - } -} diff --git a/test/Microsoft.TemplateEngine.IDE.IntegrationTests/VerifyTestCollection.cs b/test/Microsoft.TemplateEngine.IDE.IntegrationTests/VerifyTestCollection.cs deleted file mode 100644 index 80db2339a2d..00000000000 --- a/test/Microsoft.TemplateEngine.IDE.IntegrationTests/VerifyTestCollection.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace Microsoft.TemplateEngine.IDE.IntegrationTests -{ - [CollectionDefinition("Verify Tests")] - public class VerifyTestCollection : IClassFixture - { - //intentionally empty - //defines test class collection to share the fixture - //usage [Collection("Verify Tests")] on the test class. - } -} diff --git a/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/ModuleInit.cs b/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/ModuleInit.cs new file mode 100644 index 00000000000..d0db771eea3 --- /dev/null +++ b/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/ModuleInit.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Runtime.CompilerServices; +using VerifyTests.DiffPlex; + +namespace Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests; + +public static class ModuleInit +{ + [ModuleInitializer] + public static void Init() + { + DerivePathInfo( + (_, _, type, method) => new( + directory: "Approvals", + typeName: type.Name, + methodName: method.Name)); + + // Customize diff output of verifier + VerifyDiffPlex.Initialize(OutputType.Compact); + } +} \ No newline at end of file diff --git a/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/ModuleInitializerAttribute.cs b/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/ModuleInitializerAttribute.cs new file mode 100644 index 00000000000..6d578b97c6d --- /dev/null +++ b/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/ModuleInitializerAttribute.cs @@ -0,0 +1,9 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#if !NET5_0_OR_GREATER +namespace System.Runtime.CompilerServices; + +[AttributeUsage(AttributeTargets.Method, Inherited = false)] +public sealed class ModuleInitializerAttribute : Attribute; +#endif \ No newline at end of file diff --git a/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/SnapshotTests.cs b/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/SnapshotTests.cs index 002150d8ab5..78294e4ebf0 100644 --- a/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/SnapshotTests.cs +++ b/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/SnapshotTests.cs @@ -12,7 +12,6 @@ namespace Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests { - [Collection("Verify Tests")] public class SnapshotTests : TestBase { private readonly ILogger _log; diff --git a/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/VerifySettingsFixture.cs b/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/VerifySettingsFixture.cs deleted file mode 100644 index 9c427764851..00000000000 --- a/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/VerifySettingsFixture.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using VerifyTests.DiffPlex; - -namespace Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests -{ - public class VerifySettingsFixture : IDisposable - { - private static bool s_called; - - public VerifySettingsFixture() - { - if (s_called) - { - return; - } - s_called = true; - DerivePathInfo( - (_, _, type, method) => new( - directory: "Approvals", - typeName: type.Name, - methodName: method.Name)); - - // Customize diff output of verifier - VerifyDiffPlex.Initialize(OutputType.Compact); - } - - public void Dispose() { } - } -} diff --git a/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/VerifyTestCollection.cs b/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/VerifyTestCollection.cs deleted file mode 100644 index d1d7bbea76c..00000000000 --- a/test/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests/VerifyTestCollection.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace Microsoft.TemplateEngine.Orchestrator.RunnableProjects.UnitTests -{ - [CollectionDefinition("Verify Tests")] - public class VerifyTestCollection : IClassFixture - { - //intentionally empty - //defines test class collection to share the fixture - //usage [Collection("Verify Tests")] on the test class. - } -}