示例#1
0
        public void TestForSubSettingTypeRequirement()
        {
            var objA = new TestingObjectA
            {
                SemanticDataA = "Foo",
                SemanticDataB = "Bar",
                NullDataA     = "Fooz",
                NullDataB     = "Barz",
            };
            var objB = new TestingObjectB
            {
                SemanticDataA = "Foo",
                SemanticDataB = "Bar",
            };
            var objC = new TestingObjectC
            {
                SemanticDataA = "Foo"
            };

            //Assert that SemanticData fields (specific values) for compatible types are equal
            Assert.IsTrue(new Comparishon(objA, objB, DataDescriptors.Semantic).Matches);
            Assert.IsTrue(new Comparishon(objB, objA, DataDescriptors.Semantic).Matches);

            //Assert that semantic data fields allow subsetting, but not supersetting
            Assert.IsTrue(new Comparishon(objA, objC, DataDescriptors.Semantic, AllowPropertySubsetting: true).Matches);
            Assert.IsFalse(new Comparishon(objC, objA, DataDescriptors.Semantic, AllowPropertySubsetting: true).Matches);
        }
示例#2
0
        public void TestForNullDataTypeEquality()
        {
            var objA = new TestingObjectA
            {
                SemanticDataA = "Foo",
                SemanticDataB = "Bar",
                NullDataA     = "Fooz",
                NullDataB     = "Barz",
            };

            var objB = new TestingObjectA
            {
                MetadataA = Guid.NewGuid().ToString(),
                MetadataB = Guid.NewGuid().ToString(),
                NullDataA = "Fooz",
                NullDataB = "Barz",
            };

            //Assert that Metadata fields (random guids vs null) are not equal
            Assert.IsFalse(new Comparishon(objA, objB, DataDescriptors.Metadata).Matches);
            Assert.IsFalse(new Comparishon(objB, objA, DataDescriptors.Metadata).Matches);

            //Assert that semantic data fields (specific values vs null) are not equal
            Assert.IsFalse(new Comparishon(objA, objB, DataDescriptors.Semantic).Matches);
            Assert.IsFalse(new Comparishon(objB, objA, DataDescriptors.Semantic).Matches);

            //Assert that null data tyupe fields (specific values) are equal
            Assert.IsTrue(new Comparishon(objA, objB, null).Matches);
            Assert.IsTrue(new Comparishon(objB, objA, null).Matches);
        }
示例#3
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);
        }