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.
FindSetOrLoadInvocationsWalkerTests.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<FindSetOrLoadInvocationsWalker> 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 FindSetOrLoadInvocationsWalker(root, model);
16 }
17
18 [TestMethod]
19
21 {
22 var code = "public class A { }";
23 var walker = await GetWalker(code);
24 Assert.IsNull(walker.Invocation);
25 }
26
27 [TestMethod]
29 {
30 var code =
31@"using Csla;
32
33public class A : BusinessBase<A>
34{
35 public void Go() => this.GetHashCode();
36}";
37 var walker = await GetWalker(code);
38 Assert.IsNull(walker.Invocation);
39 }
40
41 [TestMethod]
43 {
44 var code =
45@"using Csla;
46
47public class A : BusinessBase<A>
48{
49 public void Go() => this.SetProperty(null, null);
50}";
51 var walker = await GetWalker(code);
52 Assert.IsNotNull(walker.Invocation);
53 }
54
55 [TestMethod]
57 {
58 var code =
59@"using Csla;
60
61public class A : BusinessBase<A>
62{
63 public void Go() => this.SetPropertyConvert<int, int>(null, 0);
64}";
65 var walker = await GetWalker(code);
66 Assert.IsNotNull(walker.Invocation);
67 }
68
69 [TestMethod]
71 {
72 var code =
73@"using Csla;
74
75public class A : BusinessBase<A>
76{
77 public void Go() => this.LoadProperty(null, null);
78}";
79 var walker = await GetWalker(code);
80 Assert.IsNotNull(walker.Invocation);
81 }
82
83 [TestMethod]
85 {
86 var code =
87@"using Csla;
88
89public class A : BusinessBase<A>
90{
91 public void Go() => this.LoadPropertyAsync<int>(null, null);
92}";
93 var walker = await GetWalker(code);
94 Assert.IsNotNull(walker.Invocation);
95 }
96
97 [TestMethod]
99 {
100 var code =
101@"using Csla;
102
103public class A : BusinessBase<A>
104{
105 public void Go() => this.LoadPropertyConvert<int, int>(null, 0);
106}";
107 var walker = await GetWalker(code);
108 Assert.IsNotNull(walker.Invocation);
109 }
110
111 [TestMethod]
113 {
114 var code =
115@"using Csla;
116
117public class A : BusinessBase<A>
118{
119 public void Go() => this.LoadPropertyMarkDirty(null, null);
120}";
121 var walker = await GetWalker(code);
122 Assert.IsNotNull(walker.Invocation);
123 }
124 }
125}