예제 #1
0
        public void CaseInsert()
        {
            // Arrange
            var model = _appDataContext.CreateModel <PainChain>();

            model.LeadId      = new Guid("e579254e-6061-4b0e-b3f8-5c421e3283b2");
            model.KeyPlayerId = new Guid("410006e1-ca4e-4502-a9ec-e54d922d2c00");

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

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

            // Act
            _appDataContext.Save();

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

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