CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
FindGetOrReadInvocationsWalkerTests.cs
Go to the documentation of this file.
1using Microsoft.VisualStudio.TestTools.UnitTesting;
2using System.Threading.Tasks;
3
5{
6 [TestClass]
8 {
9 private static async Task<FindGetOrReadInvocationsWalker> GetWalker(string code)
10 {
11 var document = TestHelpers.Create(code);
12 var root = await document.GetSyntaxRootAsync();
13 var model = await document.GetSemanticModelAsync();
14
15 return new FindGetOrReadInvocationsWalker(root, model);
16 }
17
18 [TestMethod]
20 {
21 var code = "public class A { }";
22 var walker = await GetWalker(code);
23 Assert.IsNull(walker.Invocation);
24 }
25
26 [TestMethod]
28 {
29 var code =
30@"using Csla;
31
32public class A : BusinessBase<A>
33{
34 public void Go() => this.GetHashCode();
35}";
36 var walker = await GetWalker(code);
37 Assert.IsNull(walker.Invocation);
38 }
39
40 [TestMethod]
42 {
43 var code =
44@"using Csla;
45
46public class A : BusinessBase<A>
47{
48 public void Go() => this.GetProperty(null);
49}";
50 var walker = await GetWalker(code);
51 Assert.IsNotNull(walker.Invocation);
52 }
53
54 [TestMethod]
56 {
57 var code =
58@"using Csla;
59
60public class A : BusinessBase<A>
61{
62 public void Go() => this.GetPropertyConvert<int, int>(null);
63}";
64 var walker = await GetWalker(code);
65 Assert.IsNotNull(walker.Invocation);
66 }
67
68 [TestMethod]
70 {
71 var code =
72@"using Csla;
73
74public class A : BusinessBase<A>
75{
76 public void Go() => this.ReadProperty(null);
77}";
78 var walker = await GetWalker(code);
79 Assert.IsNotNull(walker.Invocation);
80 }
81
82 [TestMethod]
84 {
85 var code =
86@"using Csla;
87
88public class A : BusinessBase<A>
89{
90 public void Go() => this.ReadPropertyConvert<int, int>(null);
91}";
92 var walker = await GetWalker(code);
93 Assert.IsNotNull(walker.Invocation);
94 }
95
96 [TestMethod]
98 {
99 var code =
100@"using Csla;
101
102public class A : BusinessBase<A>
103{
104 public void Go() => this.LazyGetProperty<int>(null, null);
105}";
106 var walker = await GetWalker(code);
107 Assert.IsNotNull(walker.Invocation);
108 }
109
110 [TestMethod]
112 {
113 var code =
114@"using Csla;
115
116public class A : BusinessBase<A>
117{
118 public void Go() => this.LazyGetPropertyAsync<int>(null, null);
119}";
120 var walker = await GetWalker(code);
121 Assert.IsNotNull(walker.Invocation);
122 }
123
124 [TestMethod]
126 {
127 var code =
128@"using Csla;
129
130public class A : BusinessBase<A>
131{
132 public void Go() => this.LazyReadProperty<int>(null, null);
133}";
134 var walker = await GetWalker(code);
135 Assert.IsNotNull(walker.Invocation);
136 }
137
138 [TestMethod]
140 {
141 var code =
142@"using Csla;
143
144public class A : BusinessBase<A>
145{
146 public void Go() => this.LazyReadPropertyAsync<int>(null, null);
147}";
148 var walker = await GetWalker(code);
149 Assert.IsNotNull(walker.Invocation);
150 }
151 }
152}