Exemple #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());
        }
Exemple #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());
        }
Exemple #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()));
        }
Exemple #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()));
        }