From 972a86669ca3d778e6f3988e011ce525056b66c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Hellander?= Date: Wed, 3 Jan 2024 12:12:35 +0100 Subject: [PATCH] Update tests for IImportScopeWrapper to run in all test projects #3594 --- .../IImportScopeWrapperCSharp10UnitTests.cs | 11 +++++++ .../IImportScopeWrapperCSharp11UnitTests.cs | 22 ++------------ .../IImportScopeWrapperCSharp12UnitTests.cs | 4 ++- .../IImportScopeWrapperCSharp7UnitTests.cs | 11 +++++++ .../IImportScopeWrapperCSharp8UnitTests.cs | 11 +++++++ .../IImportScopeWrapperCSharp9UnitTests.cs | 11 +++++++ .../Lightup/IImportScopeWrapperUnitTests.cs | 29 +++++++++++++++++++ 7 files changed, 79 insertions(+), 20 deletions(-) create mode 100644 StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp10/Lightup/IImportScopeWrapperCSharp10UnitTests.cs create mode 100644 StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/Lightup/IImportScopeWrapperCSharp7UnitTests.cs create mode 100644 StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp8/Lightup/IImportScopeWrapperCSharp8UnitTests.cs create mode 100644 StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp9/Lightup/IImportScopeWrapperCSharp9UnitTests.cs create mode 100644 StyleCop.Analyzers/StyleCop.Analyzers.Test/Lightup/IImportScopeWrapperUnitTests.cs diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp10/Lightup/IImportScopeWrapperCSharp10UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp10/Lightup/IImportScopeWrapperCSharp10UnitTests.cs new file mode 100644 index 000000000..cfefc9fa5 --- /dev/null +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp10/Lightup/IImportScopeWrapperCSharp10UnitTests.cs @@ -0,0 +1,11 @@ +// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +namespace StyleCop.Analyzers.Test.CSharp10.Lightup +{ + using StyleCop.Analyzers.Test.CSharp9.Lightup; + + public partial class IImportScopeWrapperCSharp10UnitTests : IImportScopeWrapperCSharp9UnitTests + { + } +} diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp11/Lightup/IImportScopeWrapperCSharp11UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp11/Lightup/IImportScopeWrapperCSharp11UnitTests.cs index 68ae4de6e..1980e143e 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp11/Lightup/IImportScopeWrapperCSharp11UnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp11/Lightup/IImportScopeWrapperCSharp11UnitTests.cs @@ -1,33 +1,17 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace StyleCop.Analyzers.Test.Lightup +namespace StyleCop.Analyzers.Test.CSharp11.Lightup { using System; using System.Collections.Immutable; using Microsoft.CodeAnalysis; using StyleCop.Analyzers.Lightup; + using StyleCop.Analyzers.Test.CSharp10.Lightup; using Xunit; - public class IImportScopeWrapperCSharp11UnitTests + public partial class IImportScopeWrapperCSharp11UnitTests : IImportScopeWrapperCSharp10UnitTests { - [Fact] - public void TestNull() - { - object? obj = null; - Assert.False(IImportScopeWrapper.IsInstance(obj!)); - var wrapper = IImportScopeWrapper.FromObject(obj!); - Assert.Throws(() => wrapper.Aliases); - } - - [Fact] - public void TestIncompatibleInstance() - { - var obj = new object(); - Assert.False(IImportScopeWrapper.IsInstance(obj)); - Assert.Throws(() => IImportScopeWrapper.FromObject(obj)); - } - [Fact] public void TestCompatibleInstance() { diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp12/Lightup/IImportScopeWrapperCSharp12UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp12/Lightup/IImportScopeWrapperCSharp12UnitTests.cs index 5cae05686..1efc9b3a7 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp12/Lightup/IImportScopeWrapperCSharp12UnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp12/Lightup/IImportScopeWrapperCSharp12UnitTests.cs @@ -1,8 +1,10 @@ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace StyleCop.Analyzers.Test.Lightup +namespace StyleCop.Analyzers.Test.CSharp12.Lightup { + using StyleCop.Analyzers.Test.CSharp11.Lightup; + public partial class IImportScopeWrapperCSharp12UnitTests : IImportScopeWrapperCSharp11UnitTests { } diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/Lightup/IImportScopeWrapperCSharp7UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/Lightup/IImportScopeWrapperCSharp7UnitTests.cs new file mode 100644 index 000000000..8f55c55c3 --- /dev/null +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/Lightup/IImportScopeWrapperCSharp7UnitTests.cs @@ -0,0 +1,11 @@ +// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +namespace StyleCop.Analyzers.Test.CSharp7.Lightup +{ + using StyleCop.Analyzers.Test.Lightup; + + public partial class IImportScopeWrapperCSharp7UnitTests : IImportScopeWrapperUnitTests + { + } +} diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp8/Lightup/IImportScopeWrapperCSharp8UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp8/Lightup/IImportScopeWrapperCSharp8UnitTests.cs new file mode 100644 index 000000000..2ea970a41 --- /dev/null +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp8/Lightup/IImportScopeWrapperCSharp8UnitTests.cs @@ -0,0 +1,11 @@ +// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +namespace StyleCop.Analyzers.Test.CSharp8.Lightup +{ + using StyleCop.Analyzers.Test.CSharp7.Lightup; + + public partial class IImportScopeWrapperCSharp8UnitTests : IImportScopeWrapperCSharp7UnitTests + { + } +} diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp9/Lightup/IImportScopeWrapperCSharp9UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp9/Lightup/IImportScopeWrapperCSharp9UnitTests.cs new file mode 100644 index 000000000..f0134039d --- /dev/null +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp9/Lightup/IImportScopeWrapperCSharp9UnitTests.cs @@ -0,0 +1,11 @@ +// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +namespace StyleCop.Analyzers.Test.CSharp9.Lightup +{ + using StyleCop.Analyzers.Test.CSharp8.Lightup; + + public partial class IImportScopeWrapperCSharp9UnitTests : IImportScopeWrapperCSharp8UnitTests + { + } +} diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Lightup/IImportScopeWrapperUnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/Lightup/IImportScopeWrapperUnitTests.cs new file mode 100644 index 000000000..63fb22a06 --- /dev/null +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/Lightup/IImportScopeWrapperUnitTests.cs @@ -0,0 +1,29 @@ +// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +namespace StyleCop.Analyzers.Test.Lightup +{ + using System; + using StyleCop.Analyzers.Lightup; + using Xunit; + + public class IImportScopeWrapperUnitTests + { + [Fact] + public void TestNull() + { + object? obj = null; + Assert.False(IImportScopeWrapper.IsInstance(obj!)); + var wrapper = IImportScopeWrapper.FromObject(obj!); + Assert.Throws(() => wrapper.Aliases); + } + + [Fact] + public void TestIncompatibleInstance() + { + var obj = new object(); + Assert.False(IImportScopeWrapper.IsInstance(obj)); + Assert.Throws(() => IImportScopeWrapper.FromObject(obj)); + } + } +}