Beispiel #1
0
        public void UpdateNoVersion()
        {
            EntityWithIsActive soc = new EntityWithIsActive
            {
                Attribute1 = "attribute 1",
                Attribute2 = "attribute 2",
            };

            Repository <EntityWithIsActive> socRepo = new Repository <EntityWithIsActive>(Fixture.Connection);
            var id = socRepo.Add(soc);

            soc = socRepo.ReadOne(id);

            soc.Attribute1 = "Updated Attribute1";

            socRepo.Update(soc);
            Assert.Equal("Updated Attribute1", socRepo.ReadOne(id).Attribute1);
        }
Beispiel #2
0
        public void SoftDeleteNoVersion()
        {
            EntityWithIsActive soc = new EntityWithIsActive
            {
                Attribute1 = "attribute 1",
                Attribute2 = "attribute 2",
            };

            Repository <EntityWithIsActive> socRepo = new Repository <EntityWithIsActive>(Fixture.Connection);
            var id = socRepo.Add(soc);

            Assert.Throws <MissingFieldException>(() => socRepo.Delete(id));

            Assert.True(socRepo.Delete(id, Fixture.CurrentUserId));

            soc = socRepo.ReadOne(id);

            Assert.False(soc.IsActive);
        }