public void Basic() { //Assert.Throws<Exception>(() => { // TestObjectBugs testBugs = new TestObjectBugs(); //}, "Can't create instance of primary-keyless object"); var test = new TestObject(); IQ.Track(test); Assert.IsFalse(test.IsDirty(), "New object isn't dirty"); Assert.IsTrue(test.IsNew(), "New object is new"); test.FirstName = "Jamie"; Assert.IsTrue(test.IsDirty("FirstName"), "Changing name dirtied it"); Assert.IsTrue(test.IsDirty(), "Changing a field dirtied the whole object"); int dirtyCount = 0; foreach (var item in test.DirtyFieldNames()) { dirtyCount++; Assert.AreEqual("FirstName", item, "The field that's dirty is firstname"); } Assert.AreEqual(1, dirtyCount, "There was one dirty field"); }
public void Copy() { var test = new TestObject(); IQ.MapperCache.CreateObjectData(test); test.FirstName = "Jamie"; TestObject testClone = (TestObject)test.Clone(); Assert.IsTrue(test.IsDirty()); Assert.IsFalse(testClone.IsDirty()); Assert.AreEqual("Jamie", test.FirstName); }
public void Copy() { var test = new TestObject(); IQ.MapperCache.CreateObjectData(test); test.FirstName = "Jamie"; TestObject testClone = (TestObject)test.Clone(); Assert.IsTrue(test.IsDirty()); Assert.IsFalse(testClone.IsDirty()); Assert.AreEqual("Jamie", test.FirstName); }
public void Basic() { //Assert.Throws<Exception>(() => { // TestObjectBugs testBugs = new TestObjectBugs(); //}, "Can't create instance of primary-keyless object"); var test = new TestObject(); IQ.Track(test); Assert.IsFalse(test.IsDirty(), "New object isn't dirty"); Assert.IsTrue(test.IsNew(), "New object is new"); test.FirstName = "Jamie"; Assert.IsTrue(test.IsDirty("FirstName"), "Changing name dirtied it"); Assert.IsTrue(test.IsDirty(), "Changing a field dirtied the whole object"); int dirtyCount=0; foreach (var item in test.DirtyFieldNames()) { dirtyCount++; Assert.AreEqual("FirstName",item,"The field that's dirty is firstname"); } Assert.AreEqual(1, dirtyCount, "There was one dirty field"); }