Beispiel #1
0
        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());
        }
Beispiel #2
0
        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());
        }
Beispiel #3
0
        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()));
        }
Beispiel #4
0
        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()));
        }