Esempio n. 1
0
        public void DisableEnableChangeTracking_WorksCorrectly()
        {
            var model = new MockModel()
            {
                Id = Guid.NewGuid()
            };

            model.ChangedPropertyNames.Should().BeEquivalentTo(new HashSet <string>()
            {
                "Id", "FieldDefinedWithValue"
            });

            model.DisableChangeTracking();
            model.Field4 = "test";
            model.ChangedPropertyNames.Should().BeEquivalentTo(new HashSet <string>()
            {
                "Id", "FieldDefinedWithValue"
            });

            model.EnableChangeTracking();
            model.Field2 = 123;
            model.ChangedPropertyNames.Should().BeEquivalentTo(new HashSet <string>()
            {
                "Id", "FieldDefinedWithValue", "Field2"
            });
        }