|
12 | 12 | @code{ |
13 | 13 | void CallingGetMultipleTimesReturnsSameInstance(Fixture f) |
14 | 14 | { |
15 | | - var cut1 = GetComponentUnderTest<Wrapper>(); |
16 | | - var cut2 = GetComponentUnderTest<Wrapper>(); |
| 15 | + var cut1 = f.GetComponentUnderTest<Wrapper>(); |
| 16 | + var cut2 = f.GetComponentUnderTest<Wrapper>(); |
17 | 17 |
|
18 | 18 | Assert.True(ReferenceEquals(cut1, cut2), "Getting CUT multiple times should return the same instance"); |
19 | 19 | Assert.Equal("CUT", cut1.Markup); |
20 | 20 |
|
21 | | - var firstFragmentNoId1 = GetFragment(); |
22 | | - var firstFragmentId1 = GetFragment("first"); |
23 | | - var firstFragmentNoId2 = GetFragment(); |
24 | | - var firstFragmentId2 = GetFragment("first"); |
| 21 | + var firstFragmentNoId1 = f.GetFragment(); |
| 22 | + var firstFragmentId1 = f.GetFragment("first"); |
| 23 | + var firstFragmentNoId2 = f.GetFragment(); |
| 24 | + var firstFragmentId2 = f.GetFragment("first"); |
25 | 25 | Assert.True(ReferenceEquals(firstFragmentNoId1, firstFragmentId1), "Getting first fragment with and without id should return the same instance"); |
26 | 26 | Assert.True(ReferenceEquals(firstFragmentNoId1, firstFragmentNoId2), "Getting first fragment multiple times should return the same instance"); |
27 | 27 | Assert.True(ReferenceEquals(firstFragmentId1, firstFragmentId2), "Getting first fragment multiple times should return the same instance"); |
28 | 28 | Assert.Equal("first", firstFragmentNoId1.Markup); |
29 | 29 |
|
30 | | - var secondFragmentId1 = GetFragment<Wrapper>("second"); |
31 | | - var secondFragmentId2 = GetFragment<Wrapper>("second"); |
| 30 | + var secondFragmentId1 = f.GetFragment<Wrapper>("second"); |
| 31 | + var secondFragmentId2 = f.GetFragment<Wrapper>("second"); |
32 | 32 |
|
33 | 33 | Assert.True(ReferenceEquals(secondFragmentId1, secondFragmentId2), "Getting fragment multiple times should return the same instance"); |
34 | 34 | Assert.Equal("second", secondFragmentId2.Markup); |
|
46 | 46 | @code{ |
47 | 47 | void CallingGenericGetAfterNonGenericGetThrows(Fixture f) |
48 | 48 | { |
49 | | - GetComponentUnderTest(); |
| 49 | + f.GetComponentUnderTest(); |
50 | 50 |
|
51 | 51 | // It should not be possible to call the generic GetComponentUnderTest after the non-generic has been called |
52 | | - Assert.Throws<InvalidOperationException>(() => GetComponentUnderTest<Wrapper>()); |
| 52 | + Assert.Throws<InvalidOperationException>(() => f.GetComponentUnderTest<Wrapper>()); |
53 | 53 |
|
54 | | - GetFragment(); |
| 54 | + f.GetFragment(); |
55 | 55 |
|
56 | 56 | // It should not be possible to call the generic GetFragment after the non-generic has been called |
57 | | - Assert.Throws<InvalidOperationException>(() => GetFragment<Wrapper>()); |
| 57 | + Assert.Throws<InvalidOperationException>(() => f.GetFragment<Wrapper>()); |
58 | 58 | } |
59 | 59 | } |
60 | 60 |
|
|
69 | 69 | @code{ |
70 | 70 | void CallingGetCutOrGetFragmentWithWrongGenericTypeThrows(Fixture f) |
71 | 71 | { |
72 | | - Assert.Throws<ComponentNotFoundException>(() => GetComponentUnderTest<Simple1>()); |
73 | | - Assert.Throws<ComponentNotFoundException>(() => GetFragment<Simple1>()); |
| 72 | + Assert.Throws<ComponentNotFoundException>(() => f.GetComponentUnderTest<Simple1>()); |
| 73 | + Assert.Throws<ComponentNotFoundException>(() => f.GetFragment<Simple1>()); |
74 | 74 | } |
75 | 75 | } |
76 | 76 |
|
|
85 | 85 | @code{ |
86 | 86 | void CallingGetCutOrGetFragmentWithIncompatibleGenericTypeThrows(Fixture f) |
87 | 87 | { |
88 | | - GetComponentUnderTest<Wrapper>(); |
89 | | - GetFragment<Wrapper>(); |
90 | | - Assert.Throws<InvalidOperationException>(() => GetComponentUnderTest<Simple1>()); |
91 | | - Assert.Throws<InvalidOperationException>(() => GetFragment<Simple1>()); |
| 88 | + f.GetComponentUnderTest<Wrapper>(); |
| 89 | + f.GetFragment<Wrapper>(); |
| 90 | + Assert.Throws<InvalidOperationException>(() => f.GetComponentUnderTest<Simple1>()); |
| 91 | + Assert.Throws<InvalidOperationException>(() => f.GetFragment<Simple1>()); |
92 | 92 | } |
93 | 93 | } |
0 commit comments