public void Delete() { var testClass = new AutomaticIdGuidClass(); Assert.Throws<NotFoundException>(() => testClass.Delete()); testClass.Save(); Assert.False(testClass.IsDeleted()); testClass.Delete(); Assert.True(testClass.IsDeleted()); Assert.Throws<NotFoundException>(() => testClass.Delete()); }
public void Delete() { var testClass = new AutomaticIdGuidClass(); Assert.Throws <NotFoundException>(() => testClass.Delete()); testClass.Save(); Assert.False(testClass.IsDeleted()); testClass.Delete(); Assert.True(testClass.IsDeleted()); Assert.Throws <NotFoundException>(() => testClass.Delete()); }
public void Save() { var testClass = new AutomaticIdGuidClass(); var id = testClass.Id(); testClass.Save(); Assert.False(testClass.IsNew()); Assert.False(testClass.IsModified()); Assert.Equal(id, testClass.Id()); Assert.True(id == testClass.CustomId); var loadedTestClass = Modl <AutomaticIdGuidClass> .Get(id); Assert.True(id == loadedTestClass.CustomId); Assert.Equal(id, loadedTestClass.Id()); Assert.True(id == loadedTestClass.CustomId); Assert.False(loadedTestClass.IsNew()); Assert.False(loadedTestClass.IsModified()); Assert.Throws <InvalidIdException>(() => loadedTestClass.Id(Guid.NewGuid())); }
public void Save() { var testClass = new AutomaticIdGuidClass(); var id = testClass.Id(); testClass.Save(); Assert.False(testClass.IsNew()); Assert.False(testClass.IsModified()); Assert.Equal(id, testClass.Id()); Assert.True(id == testClass.CustomId); var loadedTestClass = Modl<AutomaticIdGuidClass>.Get(id); Assert.True(id == loadedTestClass.CustomId); Assert.Equal(id, loadedTestClass.Id()); Assert.True(id == loadedTestClass.CustomId); Assert.False(loadedTestClass.IsNew()); Assert.False(loadedTestClass.IsModified()); Assert.Throws<InvalidIdException>(() => loadedTestClass.Id(Guid.NewGuid())); }