Beispiel #1
0
        public void TestOfDocuments1Vs2()
        {
            using var d1 = JsonDocument.Parse("1");
            using var d2 = JsonDocument.Parse("2");
            var diffs = JsonDiff.OfDocuments(d1, d2).ToList();

            Assert.NotEmpty(diffs);
            var valueDiff = (Diff.Value)diffs.Single();

            Assert.Equal("$", valueDiff.Item.Path);
            Assert.Equal(1, valueDiff.Item.Left.GetInt32());
            Assert.Equal(2, valueDiff.Item.Right.GetInt32());
        }
Beispiel #2
0
        public void TestOfDocumentsTrueVsFalse()
        {
            using var d1 = JsonDocument.Parse("true");
            using var d2 = JsonDocument.Parse("false");
            var diffs = JsonDiff.OfDocuments(d1, d2).ToList();

            Assert.NotEmpty(diffs);
            var kindDiff = (Diff.Kind)diffs.Single();

            Assert.Equal("$", kindDiff.Item.Path);
            Assert.True(kindDiff.Item.Left.GetBoolean());
            Assert.False(kindDiff.Item.Right.GetBoolean());
        }