9using System.Collections.Generic;
14using Microsoft.VisualStudio.TestTools.UnitTesting;
17using TestClass = NUnit.Framework.TestFixtureAttribute;
18using TestInitialize = NUnit.Framework.SetUpAttribute;
19using TestCleanup = NUnit.Framework.TearDownAttribute;
20using TestMethod = NUnit.Framework.TestAttribute;
33 _testDIContext = TestDIContextFactory.CreateDefaultContext();
37 [TestCategory(
"SkipWhenLiveUnitTesting")]
44 Assert.AreEqual(
"saved", root.Data);
45 Assert.AreEqual(
true, root.IsDirty);
46 Assert.AreEqual(
true, root.IsValid);
51 Assert.IsNotNull(root);
54 Assert.AreEqual(
"saved", root.Data);
55 Assert.AreEqual(
false, root.IsNew,
"IsNew");
56 Assert.AreEqual(
false, root.IsDeleted,
"IsDeleted");
57 Assert.AreEqual(
false, root.IsDirty,
"IsDirty");
61 [TestCategory(
"SkipWhenLiveUnitTesting")]
68 Assert.AreEqual(
"saved", root.Data);
69 Assert.AreEqual(
true, root.IsDirty,
"IsDirty");
70 Assert.AreEqual(
true, root.IsValid,
"IsValid");
75 Assert.IsNotNull(root);
77 Assert.AreEqual(
"saved", root.Data);
78 Assert.AreEqual(
false, root.IsNew,
"IsNew");
79 Assert.AreEqual(
false, root.IsDeleted,
"IsDeleted");
80 Assert.AreEqual(
false, root.IsDirty,
"IsDirty");
84 [TestCategory(
"SkipWhenLiveUnitTesting")]
89 Assert.IsNotNull(root);
91 Assert.AreEqual(
"loaded", root.Data);
92 Assert.AreEqual(
false, root.IsNew);
93 Assert.AreEqual(
false, root.IsDeleted);
94 Assert.AreEqual(
false, root.IsDirty);
95 Assert.AreEqual(
true, root.IsValid);
99 [TestCategory(
"SkipWhenLiveUnitTesting")]
107 Assert.AreEqual(
true, root.IsNew);
108 Assert.AreEqual(
true, root.IsDeleted);
109 Assert.AreEqual(
true, root.IsDirty);
112 Assert.IsNotNull(root);
114 Assert.AreEqual(
true, root.IsNew);
115 Assert.AreEqual(
false, root.IsDeleted);
116 Assert.AreEqual(
true, root.IsDirty);
120 [TestCategory(
"SkipWhenLiveUnitTesting")]
128 Assert.AreEqual(
false, root.IsNew);
129 Assert.AreEqual(
true, root.IsDeleted);
130 Assert.AreEqual(
true, root.IsDirty);
133 Assert.IsNotNull(root);
135 Assert.AreEqual(
true, root.IsNew);
136 Assert.AreEqual(
false, root.IsDeleted);
137 Assert.AreEqual(
true, root.IsDirty);
141 [TestCategory(
"SkipWhenLiveUnitTesting")]
155 private Basic.Root NewRoot()
157 IDataPortal<Basic.Root> dataPortal = _testDIContext.CreateDataPortal<Basic.Root>();
159 return dataPortal.Create(
new Basic.Root.Criteria());
162 private Basic.Root GetRoot(
string data)
164 IDataPortal<Basic.Root> dataPortal = _testDIContext.CreateDataPortal<Basic.Root>();
166 return dataPortal.Fetch(
new Basic.Root.Criteria(data));
169 private void DeleteRoot(
string data)
171 IDataPortal<Basic.Root> dataPortal = _testDIContext.CreateDataPortal<Basic.Root>();
173 dataPortal.Delete(
new Basic.Root.Criteria(data));
void ClearContextsAfterEachTest()
void DeleteRootImmediate()
static void ClassInitialize(TestContext context)
Static dictionary-like class that offers similar functionality to GlobalContext This is used in tests...
static void Reinitialise()
Reinitialise the dictionary, clearing any existing results, ready for the next test
static string GetResult(string key)
Get a result of an operation from the underlying results dictionary
Type to carry context information for DI in unit tests
Interface defining the members of the data portal type.