Beispiel #1
0
        public void CompareTwoDifferentValueObjects2()
        {
            const string Name = "1";

            EqualityComparer.AreEquals(new ReferenceEquatable(Name), new ReferenceEquatable(Name))
            .Should().BeTrue();
        }
Beispiel #2
0
        public static bool IsDefault <T>(this T obj)
        {
            var isDefault = EqualityComparer <T> .Default.Equals(obj, default(T));

            if (!isDefault)
            {
                return(EqualityComparer.AreEquals(obj, GetDefault(obj.GetType())));
            }

            return(true);
        }
Beispiel #3
0
        public void CompareTwoDifferentTypeOfValueObjectsExpectedException()
        {
            Action action = () => EqualityComparer.AreEquals(1, "2");

            action.Should().Throw <ArgumentException>();
        }
Beispiel #4
0
        public void CompareTwoEqualReferenceObjects()
        {
            var reference = new Reference();

            EqualityComparer.AreEquals(reference, reference).Should().BeTrue();
        }
Beispiel #5
0
 public void CompareTwoDifferentValueObjects()
 {
     EqualityComparer.AreEquals(1, 2).Should().BeFalse();
 }
Beispiel #6
0
 public void CompareValueObjectsWithNullParametersOrderChanged()
 {
     EqualityComparer.AreEquals(null, 1).Should().BeFalse();
 }
Beispiel #7
0
 public void CompareValueObjectsWithNull()
 {
     EqualityComparer.AreEquals(1, null).Should().BeFalse();
 }
Beispiel #8
0
 public void CompareTwoEqualValueObjects()
 {
     EqualityComparer.AreEquals(1, 1).Should().BeTrue();
 }
Beispiel #9
0
 public void CompareTwoNullValues()
 {
     EqualityComparer.AreEquals(null, null).Should().BeTrue();
 }