Exemple #1
0
        public void TestForAccurateDataSummarizationOutput()
        {
            var objA = new TestingObjectA
            {
                MetadataA     = Guid.NewGuid().ToString(),
                MetadataB     = Guid.NewGuid().ToString(),
                SemanticDataA = "Foo",
                SemanticDataB = "Bar",
            };

            var objB = new TestingObjectA
            {
                MetadataA     = objA.MetadataA,
                MetadataB     = Guid.NewGuid().ToString(),
                SemanticDataA = "Foo",
                SemanticDataB = "Bar",
            };

            //Assert that Metadata fields (random guid values) are not equal
            var ABMetadata = new Comparishon(objA, objB, DataDescriptors.Metadata);
            var BAMetadata = new Comparishon(objB, objA, DataDescriptors.Metadata);

            Assert.IsFalse(ABMetadata.Matches);
            Assert.IsTrue(ABMetadata.ChildrenEvaluations["MetadataA"].Matches);
            Assert.IsFalse(ABMetadata.ChildrenEvaluations["MetadataB"].Matches);
            Assert.IsFalse(BAMetadata.Matches);
            Assert.IsTrue(BAMetadata.ChildrenEvaluations["MetadataA"].Matches);
            Assert.IsFalse(BAMetadata.ChildrenEvaluations["MetadataB"].Matches);

            //Assert that SemanticData fields (specific values) are equal
            var ABSemantic = new Comparishon(objA, objB, DataDescriptors.Semantic);
            var BASemantic = new Comparishon(objB, objA, DataDescriptors.Semantic);

            Assert.IsTrue(ABSemantic.Matches);
            Assert.IsTrue(ABSemantic.ChildrenEvaluations["SemanticDataA"].Matches);
            Assert.IsTrue(ABSemantic.ChildrenEvaluations["SemanticDataB"].Matches);
            Assert.IsTrue(BASemantic.Matches);
            Assert.IsTrue(BASemantic.ChildrenEvaluations["SemanticDataA"].Matches);
            Assert.IsTrue(BASemantic.ChildrenEvaluations["SemanticDataB"].Matches);
        }
Exemple #2
0
        public void RunComplexObjectComparision()
        {
            var objA = new ResursiveObject()
            {
                ValueA = "Foo",
                ValueB = "Bar",
                r      = new ResursiveObject()
                {
                    ValueA = "Baz",
                    ValueB = "Buz",
                    r      = new ResursiveObject()
                    {
                        ValueA = "Quix"
                    }
                }
            };

            var objB = new ResursiveObject()
            {
                ValueA = "Foo",
                ValueB = "Bar",
                r      = new ResursiveObject()
                {
                    ValueA = "Baz",
                    ValueB = "Buz",
                    r      = new ResursiveObject()
                    {
                        ValueA = "Quax"
                    }
                }
            };

            var ABMetadata = new Comparishon(objA, objB, DataDescriptors.Metadata);

            var JsonSummary     = ABMetadata.JsonSummarization(IndentOutput: false);
            var ExpectedSummary = "{\"r\":{\"r\":{\"r\":\"Matches\",\"ValueA\":\"No Match : {Quix,Quax}\",\"ValueB\":\"Matches\"},\"ValueA\":\"Matches\",\"ValueB\":\"Matches\"},\"ValueA\":\"Matches\",\"ValueB\":\"Matches\"}";

            Assert.AreEqual(ExpectedSummary, JsonSummary);
        }