예제 #1
0
        public void CaseDelete()
        {
            // Arrange
            var model = _appDataContext.Models <PainChain>()
                        .FirstOrDefault(x => x.LeadId == new Guid("e579254e-6061-4b0e-b3f8-5c421e3283b2"));

            var trackerBeforeSave = _appDataContext.ChangeTracker.GetTrackedModel(model);

            Assert.IsNotNull(trackerBeforeSave);
            Assert.AreSame(model, trackerBeforeSave.Model);
            Assert.AreEqual(ModelState.Unchanged, trackerBeforeSave.GetStatus());

            // Act
            _appDataContext.DeleteModel(model);
            _appDataContext.Save();

            // Assert
            var trackerAfterSave = _appDataContext.ChangeTracker.GetTrackedModel(model);

            Assert.IsNull(trackerAfterSave);
            Assert.IsTrue(model.IsMarkAsDeleted);
        }