Esempio n. 1
0
        public void CompareEqualsStructsTest()
        {
            var left  = new SampleStruct();
            var right = new SampleStruct();

            Assert.IsTrue(ObjectComparer.AreStructsEqual(left, right));
        }
Esempio n. 2
0
        public void DifferentStructs_ReturnsFalse()
        {
            var rightStruct = new SampleStruct
            {
                Name  = nameof(SampleStruct),
                Value = 2,
            };

            Assert.IsFalse(ObjectComparer.AreStructsEqual(DefaultStruct, rightStruct));
        }
Esempio n. 3
0
        public void CompareDifferentStructsTest()
        {
            var left = new SampleStruct()
            {
                Name = "PEPE", Value = 1
            };
            var right = new SampleStruct()
            {
                Name = "PEPE", Value = 2
            };

            Assert.IsFalse(ObjectComparer.AreStructsEqual(left, right));
        }
Esempio n. 4
0
        public void StructsDifferentProps_ReturnsFalse()
        {
            var leftStruct = new SampleStructWithProps
            {
                StudentId = 1,
                Average   = 98.10,
                Notes     = "Good",
            };

            var rightStruct = new SampleStructWithProps
            {
                StudentId = 2,
                Average   = 79.78,
                Notes     = "Ehmm, it could be better",
            };

            Assert.IsFalse(ObjectComparer.AreStructsEqual(leftStruct, rightStruct));
        }
Esempio n. 5
0
        public void StructsSameProps_ReturnsTrue()
        {
            var leftStruct = new SampleStructWithProps
            {
                StudentId = 1,
                Average   = 98.10,
                Notes     = "Good",
            };

            var rightStruct = new SampleStructWithProps
            {
                StudentId = 1,
                Average   = 98.10,
                Notes     = "Good",
            };

            Assert.IsTrue(ObjectComparer.AreStructsEqual(leftStruct, rightStruct));
        }
Esempio n. 6
0
 public void NullType_ThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           ObjectComparer.AreStructsEqual(DefaultStruct, DefaultStruct, null));
 }
Esempio n. 7
0
 public void EqualStructs_ReturnsTrue()
 {
     Assert.IsTrue(ObjectComparer.AreStructsEqual(DefaultStruct, DefaultStruct));
 }