NStub.CSharp.ObjectGeneration.BuildDataDictionary.Save C# (CSharp) Method

Save() public method

Resets the dirty flag ( Save this instance not implemented ).
public Save ( ) : void
return void
        public void Save()
        {
            this.isDirty = false;
        }

Usage Example

Example #1
0
        public void PropertyIsDirtyNormalBehavior()
        {
            // Test read access of 'IsDirty' Property.
            var expected = false;
            var actual = testObject.IsDirty;
            Assert.AreEqual(expected, actual);

            testObject.AddDataItem("Moo", "Key", item1);
            expected = true;
            actual = testObject.IsDirty;
            Assert.AreEqual(expected, actual);

            this.testObject = new BuildDataDictionary();
            testObject.AddDataItem("YesInGeneral", item2);
            actual = testObject.IsDirty;
            Assert.AreEqual(expected, actual);

            this.testObject = new BuildDataDictionary();
            testObject.AddDataItem("NotInGeneral", "My-Key", item3);
            actual = testObject.IsDirty;
            Assert.AreEqual(expected, actual);

            testObject.Save();
            expected = false;
            actual = testObject.IsDirty;
            Assert.AreEqual(expected, actual);

            // replacing the existing from above should not affect the dirty flag.
            testObject.AddDataItem("NotInGeneral", "My-Key", item3, true);
            actual = testObject.IsDirty;
            Assert.AreEqual(expected, actual);

            testObject.AddDataItem("NotInGeneral", "My-OtherKey", item3, true);
            expected = true;
            actual = testObject.IsDirty;
            Assert.AreEqual(expected, actual);
        }