9using System.Collections.Generic;
14using Microsoft.VisualStudio.TestTools.UnitTesting;
18using TestClass = NUnit.Framework.TestFixtureAttribute;
19using TestInitialize = NUnit.Framework.SetUpAttribute;
20using TestCleanup = NUnit.Framework.TearDownAttribute;
21using TestMethod = NUnit.Framework.TestAttribute;
34 _testDIContext = TestDIContextFactory.CreateDefaultContext();
40 AParent parent = CreateAParent();
41 Assert.IsNull(parent.
GetChildList(),
"GetChildList should be null");
45 Assert.IsNotNull(list,
"ChildList should not be null");
46 Assert.IsNotNull(parent.
GetChildList(),
"GetChildList should not be null");
49 Assert.IsNotNull(parent.
GetChildList(),
"GetChildList should not be null after ApplyEdit");
55 AParent parent = CreateAParent();
56 Assert.IsNull(parent.
GetChildList(),
"GetChildList should be null");
60 Assert.IsNotNull(list,
"ChildList should not be null");
61 Assert.IsNotNull(parent.
GetChildList(),
"GetChildList should not be null");
65 Assert.IsNotNull(list,
"ChildList should not be null");
66 Assert.IsNotNull(parent.
GetChildList(),
"GetChildList should not be null after 2nd BeginEdit");
69 Assert.IsNotNull(parent.
GetChildList(),
"GetChildList should not be null after 1st CancelEdit");
72 Assert.IsNull(parent.
GetChildList(),
"GetChildList should be null after CancelEdit");
78 AParent parent = CreateAParent();
79 Assert.IsNull(parent.
GetChildList(),
"GetChildList should be null");
83 Assert.IsNotNull(list,
"ChildList should not be null");
84 Assert.IsNotNull(parent.
GetChildList(),
"GetChildList should not be null");
86 Assert.AreEqual(1, parent.
EditLevel,
"Parent edit level should be 1");
87 Assert.AreEqual(1, list.
EditLevel,
"Child list edit level should be 1");
88 Assert.AreEqual(1, list[0].EditLevel,
"Child edit level should be 1");
91 Assert.AreEqual(2, parent.
EditLevel,
"Parent edit level should be 2");
92 Assert.AreEqual(2, list.
EditLevel,
"Child list edit level should be 2");
93 Assert.AreEqual(2, list[0].EditLevel,
"Child edit level should be 2");
99 AParent parent = CreateAParent();
100 Assert.IsNull(parent.
GetChildList(),
"GetChildList should be null");
104 Assert.IsNotNull(list,
"ChildList should not be null");
105 Assert.IsNotNull(parent.
GetChildList(),
"GetChildList should not be null");
107 Assert.AreEqual(1, parent.
EditLevel,
"Parent edit level should be 1");
108 Assert.AreEqual(1, list.
EditLevel,
"Child list edit level should be 1");
109 Assert.AreEqual(1, list[0].EditLevel,
"Child edit level should be 1");
112 Assert.AreEqual(0, parent.
EditLevel,
"Parent edit level should be 0");
113 Assert.IsNull(parent.
GetChildList(),
"GetChildList should be null after CancelEdit");
119 AParent parent = CreateAParent();
120 Assert.IsNull(parent.
GetChildList(),
"GetChildList should be null");
124 Assert.IsNotNull(list,
"ChildList should not be null");
125 Assert.IsNotNull(parent.
GetChildList(),
"GetChildList should not be null");
127 Assert.AreEqual(1, parent.
EditLevel,
"Parent edit level should be 1");
128 Assert.AreEqual(1, list.
EditLevel,
"Child list edit level should be 1");
129 Assert.AreEqual(1, list[0].EditLevel,
"Child edit level should be 1");
132 Assert.AreEqual(0, parent.
EditLevel,
"Parent edit level should be 0");
134 Assert.AreEqual(0, list.
EditLevel,
"Child list edit level should be 0");
135 Assert.AreEqual(0, list[0].EditLevel,
"Child edit level should be 0");
138 private AParent CreateAParent()
142 return dataPortal.
Create();
AChildList GetChildList()
void NewChildEditLevelCancel()
void NewChildEditLevelApply()
static void ClassInitialize(TestContext context)
Type to carry context information for DI in unit tests
Interface defining the members of the data portal type.
object Create(params object[] criteria)
Called by a factory method in a business class to create a new object, which is loaded with default v...