public void TestDirty() { Document dm = new Document(); Assert.IsFalse(dm.Dirty); dm.Text = "abc"; Assert.IsTrue(dm.Dirty); dm.FileName = @"c:\abc.wordo"; DynamicMock fs = new DynamicMock(typeof (IFileSystem)); dm.Save((IFileSystem)fs.MockInstance); Assert.IsFalse(dm.Dirty); dm.Text = "abc2"; Assert.IsTrue(dm.Dirty); dm.Save((IFileSystem)fs.MockInstance); Assert.IsFalse(dm.Dirty); fs.ExpectAndReturn("ReadAllText", "abc3", @"c:\abc.wordo"); dm.Load((IFileSystem)fs.MockInstance); Assert.AreEqual("abc3", dm.Text); Assert.IsFalse(dm.Dirty); }
public void TestLoad() { Document dm = new Document(); dm.FileName = @"c:\abc.wordo"; DynamicMock fs = new DynamicMock(typeof (IFileSystem)); fs.ExpectAndReturn("ReadAllText", "abc", @"c:\abc.wordo"); dm.Load((IFileSystem)fs.MockInstance); fs.Verify(); Assert.AreEqual("abc", dm.Text); }