|
3 | 3 |
|
4 | 4 | namespace StyleCop.Analyzers.Test.CSharp11.Lightup
|
5 | 5 | {
|
6 |
| - using System; |
| 6 | + using System.Collections.Generic; |
7 | 7 | using System.Collections.Immutable;
|
8 | 8 | using Microsoft.CodeAnalysis;
|
| 9 | + using Moq; |
9 | 10 | using StyleCop.Analyzers.Lightup;
|
10 | 11 | using StyleCop.Analyzers.Test.CSharp10.Lightup;
|
11 | 12 | using Xunit;
|
12 | 13 |
|
13 | 14 | public partial class IImportScopeWrapperCSharp11UnitTests : IImportScopeWrapperCSharp10UnitTests
|
14 | 15 | {
|
15 |
| - [Fact] |
16 |
| - public void TestCompatibleInstance() |
| 16 | + [Theory] |
| 17 | + [InlineData(0)] |
| 18 | + [InlineData(1)] |
| 19 | + [InlineData(2)] |
| 20 | + public void TestCompatibleInstance(int numberOfAliasSymbols) |
17 | 21 | {
|
18 |
| - var obj = new TestImportScope(); |
| 22 | + var obj = CreateImportScope(numberOfAliasSymbols); |
19 | 23 | Assert.True(IImportScopeWrapper.IsInstance(obj));
|
20 | 24 | var wrapper = IImportScopeWrapper.FromObject(obj);
|
21 |
| - Assert.Empty(wrapper.Aliases); |
| 25 | + Assert.Equal(obj.Aliases, wrapper.Aliases); |
22 | 26 | }
|
23 | 27 |
|
24 |
| - private class TestImportScope : IImportScope |
| 28 | + private static IImportScope CreateImportScope(int numberOfAliasSymbols) |
25 | 29 | {
|
26 |
| - public ImmutableArray<IAliasSymbol> Aliases => ImmutableArray<IAliasSymbol>.Empty; |
| 30 | + var aliasSymbolMocks = new List<IAliasSymbol>(); |
| 31 | + for (var i = 0; i < numberOfAliasSymbols; i++) |
| 32 | + { |
| 33 | + aliasSymbolMocks.Add(Mock.Of<IAliasSymbol>()); |
| 34 | + } |
27 | 35 |
|
28 |
| - public ImmutableArray<IAliasSymbol> ExternAliases => throw new NotImplementedException(); |
29 |
| - |
30 |
| - public ImmutableArray<ImportedNamespaceOrType> Imports => throw new NotImplementedException(); |
31 |
| - |
32 |
| - public ImmutableArray<ImportedXmlNamespace> XmlNamespaces => throw new NotImplementedException(); |
| 36 | + var importScopeMock = new Mock<IImportScope>(); |
| 37 | + importScopeMock.Setup(x => x.Aliases).Returns(aliasSymbolMocks.ToImmutableArray()); |
| 38 | + return importScopeMock.Object; |
33 | 39 | }
|
34 | 40 | }
|
35 | 41 | }
|
0 commit comments