示例#1
0
        public void IfMatchHandlesNullValuesForNonNullable()
        {
            // Arrange
            JsonPatchDocument doc = new JsonPatchDocument();

            doc.Add("/Created", null);

            BugReportPatchVisitor callback = new BugReportPatchVisitor();

            // Act + Assert
            AssertThrows <JsonPatchParserException>(() => doc.Apply(callback));
        }
示例#2
0
        public void CanUseIfMatchInVisitor()
        {
            // Arrange
            JsonPatchDocument doc = new JsonPatchDocument();

            doc.Add("/Id", 10);

            BugReportPatchVisitor callback = new BugReportPatchVisitor();

            // Act
            doc.Apply(callback);

            // Assert
            Assert.AreEqual("/Id => 10|", callback.Result);
        }
示例#3
0
        public void IfMatchHandlesNullValuesForNullable()
        {
            // Arrange
            JsonPatchDocument doc = new JsonPatchDocument();

            doc.Add("/Responsible", null);
            doc.Add("/Title", null);
            doc.Add("/LastModified", null);

            BugReportPatchVisitor callback = new BugReportPatchVisitor();

            // Act
            doc.Apply(callback);

            // Assert
            Assert.AreEqual("/Responsible => |/Title => |/LastModified => |", callback.Result);
        }