public void ABCompare_ReturnsTrueWhenDerivedTypeIsDifferent()
        {
            var x   = new UnionAB(1);
            var y   = new UnionABPrime(1);
            var sut = UnionAB.Comparer;

            Assert.IsTrue(sut.Equals(x, y));
        }
        public void ABCompare_ReturnsFalseWhenUnderlyingTypeIsDifferent()
        {
            var x   = new UnionAB(1);
            var y   = new UnionAB(new B());
            var sut = UnionAB.Comparer;

            Assert.IsFalse(sut.Equals(x, y));
        }
        public void ABCompare_ReturnsFalseWhenSecondUnderlyingTypeIsNotEqual()
        {
            var x   = new UnionAB(new B());
            var y   = new UnionAB(new B());
            var sut = UnionAB.Comparer;

            Assert.IsFalse(sut.Equals(x, y));
        }
        public void ABCompare_ReturnsTrueWhenFirstUnderlyingTypeIsEqual()
        {
            var x   = new UnionAB(1);
            var y   = new UnionAB(1);
            var sut = UnionAB.Comparer;

            Assert.IsTrue(sut.Equals(x, y));
        }
示例#5
0
        public void UnionSerialization()
        {
            var obj = UnionAB.TypeB(
                new TypeB(a: new ScalarA(""), new Uri("https://example.com/lol"), 3));
            var json = ModelSerializer.SerializeObject(obj);
            var obj2 = ModelSerializer.DeserializeObject <UnionAB>(json);

            Assert.Equal(obj, obj2);
            check.CheckString(json, fileExtension: "json");
        }
示例#6
0
 private void ClearSets()
 {
     SetA.Clear();
     SetB.Clear();
     SetT.Clear();
     if (IntersectionAB != null)
     {
         IntersectionAB.Clear();
     }
     if (UnionAB != null)
     {
         UnionAB.Clear();
     }
     if (RelativeComplementAB != null)
     {
         RelativeComplementAB.Clear();
     }
 }