Ejemplo n.º 1
0
 public void ComparingT2ValueWithNull_ResultsInNotEqual()
 {
     var a = new Union<int, string>(null);
     IsFalse(a.Equals(null));
     IsTrue(a != null);
     IsTrue(null != a);
 }
 public void DifferentT3Values_ArentEqual()
 {
     var a = new Union<int, string, Colors>(Colors.Blue);
     var b = new Union<int, string, Colors>(Colors.Green);
     IsFalse(a.Equals(b));
     IsTrue(a != b);
 }
Ejemplo n.º 3
0
 public void DifferentT2Values_ArentEqual()
 {
     var a = new Union<int, string>("a");
     var b = new Union<int, string>("b");
     IsFalse(a.Equals(b));
     IsTrue(a != b);
 }
Ejemplo n.º 4
0
 public void DifferentT4Values_ArentEqual()
 {
     var a = new Union<int, string, Colors, Animals>(Animals.Cat);
     var b = new Union<int, string, Colors, Animals>(Animals.Cow);
     IsFalse(a.Equals(b));
     IsFalse(a == b);
 }
Ejemplo n.º 5
0
 public void DifferentT3Values_ArentEqual()
 {
     var a = new Union<int, string, Colors, Animals>(Colors.Blue);
     var b = new Union<int, string, Colors, Animals>(Colors.Red);
     IsFalse(a.Equals(b));
     IsFalse(a == b);
 }
 public void DifferentT2Values_ArentEqual()
 {
     var a = new Union<int, string, Colors>("abc");
     var b = new Union<int, string, Colors>("def");
     IsFalse(a.Equals(b));
     IsTrue(a != b);
 }
        public void ComparingT4ValueWithNull_ResultsInNotEqual()
        {
            var a = new Union <int, string, Colors, Animals>(Animals.Dog);

            IsFalse(a.Equals(null));
            IsTrue(a != null);
            IsTrue(null != a);
        }
        public void DifferentT3Values_ArentEqual()
        {
            var a = new Union <int, string, Colors, Animals>(Colors.Blue);
            var b = new Union <int, string, Colors, Animals>(Colors.Red);

            IsFalse(a.Equals(b));
            IsFalse(a == b);
        }
        public void DifferentT4Values_ArentEqual()
        {
            var a = new Union <int, string, Colors, Animals>(Animals.Cat);
            var b = new Union <int, string, Colors, Animals>(Animals.Cow);

            IsFalse(a.Equals(b));
            IsFalse(a == b);
        }
Ejemplo n.º 10
0
 public void DifferentValues_AreNotEqualAndHaveDifferentHashCodes()
 {
     var a = new Union<int, string>(0);
     var b = new Union<int, string>("1234");
     IsFalse(a.Equals(b));
     IsTrue(a != b);
     AreNotEqual(a.GetHashCode(), b.GetHashCode());
 }
Ejemplo n.º 11
0
 public void SameT2Values_AreEqualAndHaveSameHashCode()
 {
     var a = new Union<int, string>("1234");
     var b = new Union<int, string>("1234");
     IsTrue(a.Equals(b));
     IsTrue(a == b);
     AreEqual(a.GetHashCode(), b.GetHashCode());
 }
Ejemplo n.º 12
0
        public void EqalsObj_ReturnsCorrectResult(Union <int, double, string> x, object y, bool expected)
        {
            // Act
            bool er = x.Equals(y);

            // Assert
            er.Should().Be(expected);
        }
Ejemplo n.º 13
0
 public void SameT4Values_AreEqualAndHaveSameHashCode()
 {
     var a = new Union<int, string, Colors, Animals>(Animals.Cat);
     var b = new Union<int, string, Colors, Animals>(Animals.Cat);
     IsTrue(a.Equals(b));
     IsTrue(a == b);
     AreEqual(a.GetHashCode(), b.GetHashCode());
 }
        public void DifferentT2Values_ArentEqual()
        {
            var a = new Union <int, string, Colors, Animals>("abc");
            var b = new Union <int, string, Colors, Animals>("def");

            IsFalse(a.Equals(b));
            IsFalse(a == b);
        }
Ejemplo n.º 15
0
        public void DifferentT1Values_ArentEqual()
        {
            var a = new Union <int, string, Colors>(1);
            var b = new Union <int, string, Colors>(2);

            IsFalse(a.Equals(b));
            IsTrue(a != b);
        }
Ejemplo n.º 16
0
        public void DifferentT2Values_ArentEqual()
        {
            var a = new Union <int, string>("a");
            var b = new Union <int, string>("b");

            IsFalse(a.Equals(b));
            IsTrue(a != b);
        }
 public void DifferentT1T3Values_AreNotEqualAndHaveDifferentHashCodes()
 {
     var a = new Union<int, string, Colors>(0);
     var b = new Union<int, string, Colors>(Colors.Green);
     IsFalse(a.Equals(b));
     IsTrue(a != b);
     AreNotEqual(a.GetHashCode(), b.GetHashCode());
 }
Ejemplo n.º 18
0
        public void ComparingT3ValueWithNull_ResultsInNotEqual()
        {
            var a = new Union <int, string, Colors>(Colors.Red);

            IsFalse(a.Equals(null));
            IsTrue(a != null);
            IsTrue(null != a);
        }
 public void SameT3Values_AreEqualAndHaveSameHashCode()
 {
     var a = new Union<int, string, Colors>(Colors.Blue);
     var b = new Union<int, string, Colors>(Colors.Blue);
     IsTrue(a.Equals(b));
     IsTrue(a == b);
     AreEqual(a.GetHashCode(), b.GetHashCode());
 }
Ejemplo n.º 20
0
        public void ComparingT1ValueWithNull_ResultsInNotEqual()
        {
            var a = new Union <int, string>(1);

            IsFalse(a.Equals(null));
            IsTrue(a != null);
            IsTrue(null != a);
        }
Ejemplo n.º 21
0
        public void DifferentT3Values_ArentEqual()
        {
            var a = new Union <int, string, Colors>(Colors.Blue);
            var b = new Union <int, string, Colors>(Colors.Green);

            IsFalse(a.Equals(b));
            IsTrue(a != b);
        }
Ejemplo n.º 22
0
        public void SameT3Values_AreEqualAndHaveSameHashCode()
        {
            var a = new Union <int, string, Colors>(Colors.Blue);
            var b = new Union <int, string, Colors>(Colors.Blue);

            IsTrue(a.Equals(b));
            IsTrue(a == b);
            AreEqual(a.GetHashCode(), b.GetHashCode());
        }
 public void UnionEqualsSameUnion()
 {
     Union<Item, DataUnit> union1 = new Union<Item, DataUnit>.Case1(new Item(42));
     Union<Item, DataUnit> union2 = new Union<Item, DataUnit>.Case1(new Item(42));
     Assert.True(union1.Equals(union2));
     Assert.True(union2.Equals(union1));
     Assert.True(union1 == union2);
     Assert.True(union2 == union1);
 }
Ejemplo n.º 24
0
        public void SameT2Values_AreEqualAndHaveSameHashCode()
        {
            var a = new Union <int, string>("1234");
            var b = new Union <int, string>("1234");

            IsTrue(a.Equals(b));
            IsTrue(a == b);
            AreEqual(a.GetHashCode(), b.GetHashCode());
        }
 public void UnionIsNotEqualToStructurallyInequalUnion()
 {
     Union<Item, DataUnit> union1 = new Union<Item, DataUnit>.Case1(new Item(42));
     Union<Item, DataUnit> union2 = new Union<Item, DataUnit>.Case2(new DataUnit(42));
     Assert.False(union1.Equals(union2));
     Assert.False(union2.Equals(union1));
     Assert.True(union1 != union2);
     Assert.True(union2 != union1);
 }
        public void DifferentT1T2Values_AreNotEqualAndHaveDifferentHashCodes()
        {
            var a = new Union <int, string, Colors, Animals>(2);
            var b = new Union <int, string, Colors, Animals>("1234");

            IsFalse(a.Equals(b));
            IsTrue(a != b);
            AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
        public void DifferentT3T4Values_AreNotEqualAndHaveDifferentHashCodes()
        {
            var a = new Union <int, string, Colors, Animals>(Colors.Red);
            var b = new Union <int, string, Colors, Animals>(Animals.Cow);

            IsFalse(a.Equals(b));
            IsTrue(a != b);
            AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
        public void SameT4Values_AreEqualAndHaveSameHashCode()
        {
            var a = new Union <int, string, Colors, Animals>(Animals.Cat);
            var b = new Union <int, string, Colors, Animals>(Animals.Cat);

            IsTrue(a.Equals(b));
            IsTrue(a == b);
            AreEqual(a.GetHashCode(), b.GetHashCode());
        }
Ejemplo n.º 29
0
        public void DifferentT2T3Values_AreNotEqualAndHaveDifferentHashCodes()
        {
            var a = new Union <int, string, Colors>("xyz");
            var b = new Union <int, string, Colors>(Colors.Green);

            IsFalse(a.Equals(b));
            IsTrue(a != b);
            AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
        public void UnionEqualsSameUnion()
        {
            Union <Item, DataUnit> union1 = new Union <Item, DataUnit> .Case1(new Item(42));

            Union <Item, DataUnit> union2 = new Union <Item, DataUnit> .Case1(new Item(42));

            Assert.True(union1.Equals(union2));
            Assert.True(union2.Equals(union1));
            Assert.True(union1 == union2);
            Assert.True(union2 == union1);
        }
        public void UnionIsNotEqualToStructurallyInequalUnion()
        {
            Union <Item, DataUnit> union1 = new Union <Item, DataUnit> .Case1(new Item(42));

            Union <Item, DataUnit> union2 = new Union <Item, DataUnit> .Case2(new DataUnit(42));

            Assert.False(union1.Equals(union2));
            Assert.False(union2.Equals(union1));
            Assert.True(union1 != union2);
            Assert.True(union2 != union1);
        }
Ejemplo n.º 32
0
 public void DifferentT3T4Values_AreNotEqualAndHaveDifferentHashCodes()
 {
     var a = new Union<int, string, Colors, Animals>(Colors.Red);
     var b = new Union<int, string, Colors, Animals>(Animals.Cow);
     IsFalse(a.Equals(b));
     IsTrue(a != b);
     AreNotEqual(a.GetHashCode(), b.GetHashCode());
 }
        public void UnionEqualsItself()
        {
            Union <Item, DataUnit> union = new Union <Item, DataUnit> .Case1(new Item(42));

            Assert.True(union.Equals(union));
        }
 public void UnionEqualsItself()
 {
     Union<Item, DataUnit> union = new Union<Item, DataUnit>.Case1(new Item(42));
     Assert.True(union.Equals(union));
 }
Ejemplo n.º 35
0
 public void ComparingT4ValueWithNull_ResultsInNotEqual()
 {
     var a = new Union<int, string, Colors, Animals>(Animals.Dog);
     IsFalse(a.Equals(null));
     IsTrue(a != null);
     IsTrue(null != a);
 }