public void NotEqualWhenIdsAreDifferent()
        {
            var left  = new TestId(1);
            var right = new TestId(2);

            left.Equals(right as object).Should().BeFalse();
            left.Equals(right).Should().BeFalse();
            (left == right).Should().BeFalse();
            (left != right).Should().BeTrue();
        }
        public void EqualWhenIdsAreEqual()
        {
            var left  = new TestId(1);
            var right = new TestId(1);

            left.Equals(right as object).Should().BeTrue();
            left.Equals(right).Should().BeTrue();
            (left == right).Should().BeTrue();
            (left != right).Should().BeFalse();
            left.GetHashCode().Should().Be(right.GetHashCode());
        }
        public void NotEqualWhenTheOtherIsNull()
        {
            var    left  = new TestId(1);
            TestId?right = null;

            left.Equals(right as object).Should().BeFalse();
            left.Equals(right).Should().BeFalse();
            (left == right).Should().BeFalse();
            (left != right).Should().BeTrue();

            (right == left).Should().BeFalse();
            (right != left).Should().BeTrue();
        }
示例#4
0
        public void Equals_Null_ReturnsFalse()
        {
            // Arrange
            var id1 = new TestId("cf58a681-100c-471a-9147-37ebe09c721d");
            var id2 = (IdBase)null;

            // Act - Equals from IEquatable
            var resultEquatable = id1.Equals(id2);

            // Act - Equals from object
            var resultObject = id1.Equals((object)id2);

            // Assert
            Assert.That(resultEquatable, Is.False);
            Assert.That(resultObject, Is.False);
        }
示例#5
0
        public void Equals_IdWithSameValue_ReturnsTrue()
        {
            // Arrange
            var id1 = new TestId("cf58a681-100c-471a-9147-37ebe09c721d");
            var id2 = new TestId("cf58a681-100c-471a-9147-37ebe09c721d");

            // Act - Equals from IEquatable
            var resultEquatable = id1.Equals(id2);

            // Act - Equals from object
            var resultObject = id1.Equals((object)id2);

            // Assert
            Assert.That(resultEquatable, Is.True);
            Assert.That(resultObject, Is.True);
        }
示例#6
0
        public void Equals_SameId_ReturnsTrue()
        {
            // Arrange
            var id1 = new TestId();
            var id2 = id1;

            // Act - Equals from IEquatable
            var resultEquatable = id1.Equals(id2);

            // Act - Equals from object
            var resultObject = id1.Equals((object)id2);

            // Assert
            Assert.That(resultEquatable, Is.True);
            Assert.That(resultObject, Is.True);
        }
示例#7
0
        public void Equals_IdWithDifferentTypesButSaveValue_ReturnsFale()
        {
            // Arrange
            var id1 = new TestId("cf58a681-100c-471a-9147-37ebe09c721d");
            var id2 = new OtherTestId("cf58a681-100c-471a-9147-37ebe09c721d");

            // Act - Equals from IEquatable
            var resultEquatable = id1.Equals(id2);

            // Act - Equals from object
            var resultObject = id1.Equals((object)id2);

            // Assert
            Assert.That(resultEquatable, Is.False);
            Assert.That(resultObject, Is.False);
        }
示例#8
0
        public void Equals_IdWithDifferentValue_ReturnsFalse()
        {
            // Arrange
            var id1 = new TestId("cf58a681-100c-471a-9147-37ebe09c721d");
            var id2 = new TestId("003d9337-b323-4b26-9e29-fc6793d93212");

            // Act - Equals from IEquatable
            var resultEquatable = id1.Equals(id2);

            // Act - Equals from object
            var resultObject = id1.Equals((object)id2);

            // Assert
            Assert.That(resultEquatable, Is.False);
            Assert.That(resultObject, Is.False);
        }
 public bool Equals(Asp330SequenceTest that)
 {
     if (that is null)
     {
         return(false);
     }
     if (ReferenceEquals(this, that))
     {
         return(true);
     }
     if (!SequenceId.Equals(that.SequenceId))
     {
         return(false);
     }
     if (!TestId.Equals(that.TestId))
     {
         return(false);
     }
     if (!SequenceName.Equals(that.SequenceName))
     {
         return(false);
     }
     if (!TestName.Equals(that.TestName))
     {
         return(false);
     }
     if (!TestTableName.Equals(that.TestTableName))
     {
         return(false);
     }
     return(true);
 }
示例#10
0
        public void EqualsTest()
        {
            var testId1 = new TestId(10);

            Assert.False(testId1.Equals(null));
            Assert.True(testId1.Equals(testId1));

            var testId2 = new TestId(10);

            Assert.True(testId1.Equals(testId2));

            var testId3 = new TestId(11);

            Assert.False(testId1.Equals(testId3));

            var extendedTestId1 = new ExtendedTestId(10);

            Assert.False(testId1.Equals(extendedTestId1));
        }