Esempio n. 1
0
        public void ReplaceGivenPropertyWithNoAttributesSetsCorrectPatchOperation()
        {
            //Arrange
            IPatchOperationBuilder <Item1> builder = new PatchOperationBuilder <Item1>();

            //Act
            builder.Replace(x => x.TestIntProperty, 50);

            //Assert
            PatchOperation operation = builder.PatchOperations.First();

            Assert.Equal(PatchOperationType.Replace, operation.OperationType);
            Assert.Equal("/testIntProperty", operation.Path);
        }
Esempio n. 2
0
        public void ReplaceGivenPropertyWithRequiredAndJsonAttributesSetsCorrectPatchOperation()
        {
            //Arrange
            IPatchOperationBuilder <RequiredAndJsonItem> builder = new PatchOperationBuilder <RequiredAndJsonItem>();

            //Act
            builder.Replace(x => x.TestProperty, "Test Value");

            //Assert
            PatchOperation operation = builder.PatchOperations.First();

            Assert.Equal(PatchOperationType.Replace, operation.OperationType);
            Assert.Equal("/testProperty", operation.Path);
        }
Esempio n. 3
0
        public void ReplaceGivenPropertyValueWithJsonAttributeSetsCorrectReplaceValue()
        {
            //Arrange
            IPatchOperationBuilder <Item1> builder = new PatchOperationBuilder <Item1>();

            //Act
            builder.Replace(x => x.TestProperty, "100");

            //Assert
            PatchOperation operation = builder.PatchOperations.First();

            Assert.Equal(PatchOperationType.Replace, operation.OperationType);
            Assert.Equal("/thisIsTheName", operation.Path);
        }