diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp11/Lightup/IImportScopeWrapperCSharp11UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp11/Lightup/IImportScopeWrapperCSharp11UnitTests.cs index 1980e143e..2043f5cba 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp11/Lightup/IImportScopeWrapperCSharp11UnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp11/Lightup/IImportScopeWrapperCSharp11UnitTests.cs @@ -3,33 +3,39 @@ namespace StyleCop.Analyzers.Test.CSharp11.Lightup { - using System; + using System.Collections.Generic; using System.Collections.Immutable; using Microsoft.CodeAnalysis; + using Moq; using StyleCop.Analyzers.Lightup; using StyleCop.Analyzers.Test.CSharp10.Lightup; using Xunit; public partial class IImportScopeWrapperCSharp11UnitTests : IImportScopeWrapperCSharp10UnitTests { - [Fact] - public void TestCompatibleInstance() + [Theory] + [InlineData(0)] + [InlineData(1)] + [InlineData(2)] + public void TestCompatibleInstance(int numberOfAliasSymbols) { - var obj = new TestImportScope(); + var obj = CreateImportScope(numberOfAliasSymbols); Assert.True(IImportScopeWrapper.IsInstance(obj)); var wrapper = IImportScopeWrapper.FromObject(obj); - Assert.Empty(wrapper.Aliases); + Assert.Equal(obj.Aliases, wrapper.Aliases); } - private class TestImportScope : IImportScope + private static IImportScope CreateImportScope(int numberOfAliasSymbols) { - public ImmutableArray Aliases => ImmutableArray.Empty; + var aliasSymbolMocks = new List(); + for (var i = 0; i < numberOfAliasSymbols; i++) + { + aliasSymbolMocks.Add(Mock.Of()); + } - public ImmutableArray ExternAliases => throw new NotImplementedException(); - - public ImmutableArray Imports => throw new NotImplementedException(); - - public ImmutableArray XmlNamespaces => throw new NotImplementedException(); + var importScopeMock = new Mock(); + importScopeMock.Setup(x => x.Aliases).Returns(aliasSymbolMocks.ToImmutableArray()); + return importScopeMock.Object; } } } diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp11/StyleCop.Analyzers.Test.CSharp11.csproj b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp11/StyleCop.Analyzers.Test.CSharp11.csproj index 3ce4f0d1c..1172669bb 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp11/StyleCop.Analyzers.Test.CSharp11.csproj +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp11/StyleCop.Analyzers.Test.CSharp11.csproj @@ -19,6 +19,7 @@ +