예제 #1
0
        public void ApplyUpdate_MoveOperation_EntityUpdated()
        {
            //Arrange
            var patchDocument = new JsonPatchDocument<SimpleEntity>();
            var entity = new SimpleEntity { Foo = "bar", Baz = "qux" };

            //Act
            patchDocument.Move("Foo", "Baz");
            patchDocument.ApplyUpdatesTo(entity);

            //Assert
            Assert.IsNull(entity.Foo);
            Assert.AreEqual("bar", entity.Baz);
        }
예제 #2
0
        public void ApplyUpdate_ReplaceOperation_EntityUpdated()
        {
            //Arrange
            var patchDocument = new JsonPatchDocument<SimpleEntity>();
            var entity = new SimpleEntity { Foo = "bar" };

            //Act
            patchDocument.Replace("Foo", "baz");
            patchDocument.ApplyUpdatesTo(entity);

            //Assert
            Assert.AreEqual("baz", entity.Foo);
        }