1using Microsoft.VisualStudio.TestTools.UnitTesting;
2using System.Threading.Tasks;
9 private static async Task<FindGetOrReadInvocationsWalker> GetWalker(
string code)
11 var document = TestHelpers.Create(code);
12 var root = await document.GetSyntaxRootAsync();
13 var model = await document.GetSemanticModelAsync();
15 return new FindGetOrReadInvocationsWalker(root, model);
21 var code =
"public class A { }";
22 var walker = await GetWalker(code);
23 Assert.IsNull(walker.Invocation);
32public class A : BusinessBase<A>
34 public void Go() => this.GetHashCode();
36 var walker = await GetWalker(code);
37 Assert.IsNull(walker.Invocation);
46public class A : BusinessBase<A>
48 public void Go() => this.GetProperty(null);
50 var walker = await GetWalker(code);
51 Assert.IsNotNull(walker.Invocation);
60public class A : BusinessBase<A>
62 public void Go() => this.GetPropertyConvert<int, int>(null);
64 var walker = await GetWalker(code);
65 Assert.IsNotNull(walker.Invocation);
74public class A : BusinessBase<A>
76 public void Go() => this.ReadProperty(null);
78 var walker = await GetWalker(code);
79 Assert.IsNotNull(walker.Invocation);
88public class A : BusinessBase<A>
90 public void Go() => this.ReadPropertyConvert<int, int>(null);
92 var walker = await GetWalker(code);
93 Assert.IsNotNull(walker.Invocation);
102public class A : BusinessBase<A>
104 public void Go() => this.LazyGetProperty<int>(null, null);
106 var walker = await GetWalker(code);
107 Assert.IsNotNull(walker.Invocation);
116public class A : BusinessBase<A>
118 public void Go() => this.LazyGetPropertyAsync<int>(null, null);
120 var walker = await GetWalker(code);
121 Assert.IsNotNull(walker.Invocation);
130public class A : BusinessBase<A>
132 public void Go() => this.LazyReadProperty<int>(null, null);
134 var walker = await GetWalker(code);
135 Assert.IsNotNull(walker.Invocation);
144public class A : BusinessBase<A>
146 public void Go() => this.LazyReadPropertyAsync<int>(null, null);
148 var walker = await GetWalker(code);
149 Assert.IsNotNull(walker.Invocation);
async Task WalkWhenContainingTypeIsBusinessBaseAndInvocationIsLazyReadPropertyAsync()
async Task WalkWhenContainingTypeIsBusinessBaseAndInvocationIsReadProperty()
async Task WalkWhenContainingTypeIsBusinessBaseAndInvocationIsLazyGetPropertyAsync()
async Task WalkWhenContainingTypeIsBusinessBaseAndInvocationIsNotCslaMethod()
async Task WalkWhenContainingTypeIsBusinessBaseAndInvocationIsLazyReadProperty()
async Task WalkWhenContainingTypeIsBusinessBaseAndInvocationIsGetPropertyConvert()
async Task WalkWhenContainingTypeIsBusinessBaseAndInvocationIsGetProperty()
async Task WalkWhenContainingTypeIsBusinessBaseAndInvocationIsLazyGetProperty()
async Task WalkWhenContainingTypeIsNotBusinessBase()
async Task WalkWhenContainingTypeIsBusinessBaseAndInvocationIsReadPropertyConvert()