Apply() public method

public Apply ( PatchRequest patch ) : RavenJObject
patch PatchRequest
return RavenJObject
Example #1
0
        public void RemoveItemFromArrayByNonExistingValue()
        {
            var value = @"{""name"":""Joe Doe"",""roles"":[""first/role"",""second/role"",""third/role""]}";
            var patchedDoc = new JsonPatcher(RavenJObject.Parse(value));

            var result = patchedDoc.Apply(
                new[]
                {
                    new PatchRequest
                    {
                        Type = PatchCommandType.Remove,
                        Name = "roles",
                        Value = "this/does/not/exist"
                    },
                });

            Assert.Equal(value, result.ToString(Formatting.None));
        }