|
3 | 3 |
|
4 | 4 | namespace IT.Web.Common.Tests;
|
5 | 5 |
|
6 |
| -public class UnitTest1 |
| 6 | +public class WebAppTypeFinderTests |
7 | 7 | {
|
8 | 8 | [Fact]
|
9 |
| - public void Return() |
| 9 | + public void FindClassesOfType_ReturnsTheAppropriateTypes() |
10 | 10 | {
|
11 | 11 | ITypeFinder finder = new WebAppTypeFinder();
|
12 | 12 |
|
13 |
| - List<Type> findableInterfaceType = finder.FindClassesOfType<IMyInterface>().ToList(); |
14 |
| - findableInterfaceType.Count.Should().Be(1); |
| 13 | + Type[] findableInterfaceType = finder.FindClassesOfType<IMyInterface>().ToArray(); |
| 14 | + findableInterfaceType.Length.Should().Be(1); |
15 | 15 | typeof(IMyInterface).IsAssignableFrom(findableInterfaceType.FirstOrDefault()).Should().BeTrue();
|
16 | 16 |
|
17 |
| - List<Type> findableClassType = finder.FindClassesOfType<MyFindableClass>().ToList(); |
18 |
| - findableClassType.Count.Should().Be(1); |
| 17 | + Type[] findableClassType = finder.FindClassesOfType<MyFindableClass>().ToArray(); |
| 18 | + findableClassType.Length.Should().Be(1); |
19 | 19 | typeof(MyFindableClass).IsAssignableFrom(findableClassType.FirstOrDefault()).Should().BeTrue();
|
20 | 20 |
|
21 |
| - List<Type> ignoredType = finder.FindClassesOfType<MyIgnoredClass>().ToList(); |
22 |
| - ignoredType.Count.Should().Be(0); |
| 21 | + Type[] ignoredType = finder.FindClassesOfType<MyIgnoredClass>().ToArray(); |
| 22 | + ignoredType.Length.Should().Be(0); |
23 | 23 | }
|
24 |
| -} |
25 | 24 |
|
26 |
| -public interface IMyInterface |
27 |
| -{ |
| 25 | + // ReSharper disable once MemberCanBePrivate.Global |
| 26 | + public interface IMyInterface |
| 27 | + { |
28 | 28 |
|
29 |
| -} |
| 29 | + } |
30 | 30 |
|
31 |
| -public class MyFindableClass : IMyInterface |
32 |
| -{ |
| 31 | + // ReSharper disable once MemberCanBePrivate.Global |
| 32 | + public class MyFindableClass : IMyInterface |
| 33 | + { |
33 | 34 |
|
34 |
| -} |
| 35 | + } |
35 | 36 |
|
36 |
| -[ReflectionIgnore] |
37 |
| -public class MyIgnoredClass : IMyInterface |
38 |
| -{ |
| 37 | + [ReflectionIgnore] |
| 38 | + // ReSharper disable once MemberCanBePrivate.Global |
| 39 | + // ReSharper disable once ClassNeverInstantiated.Global |
| 40 | + public class MyIgnoredClass : IMyInterface |
| 41 | + { |
39 | 42 |
|
| 43 | + } |
40 | 44 | }
|
0 commit comments