Equals() public méthode

public Equals ( object obj ) : bool
obj object
Résultat bool
        public void SutDoesNotEqualAnonymousObject()
        {
            var sut = new AndMortgageApplicationSpecification();
            var anonymous = new object();

            var actual = sut.Equals(anonymous);

            Assert.False(actual);
        }
        public void SutEqualsOtherWithSameSpecifications()
        {
            // Arrange
            var spec1 = new Mock<IMortgageApplicationSpecification>();
            var spec2 = new Mock<IMortgageApplicationSpecification>();
            var spec3 = new Mock<IMortgageApplicationSpecification>();

            var sut = new AndMortgageApplicationSpecification
            {
                Specifications = new[] { spec1.Object, spec2.Object, spec3.Object }
            };

            var other = new AndMortgageApplicationSpecification
            {
                Specifications = new[] { spec1.Object, spec2.Object, spec3.Object }
            };

            // Act
            var actual = sut.Equals(other);

            // Assert
            Assert.True(actual);
        }
        public void SutDoesNotEqualOtherWithDifferentSpecifications()
        {
            // Arrange
            var sut = new AndMortgageApplicationSpecification
            {
                Specifications = new[]
                {
                    new Mock<IMortgageApplicationSpecification>().Object,
                    new Mock<IMortgageApplicationSpecification>().Object,
                    new Mock<IMortgageApplicationSpecification>().Object
                }
            };

            var other = new AndMortgageApplicationSpecification
            {
                Specifications = new[]
                {
                    new Mock<IMortgageApplicationSpecification>().Object,
                    new Mock<IMortgageApplicationSpecification>().Object,
                    new Mock<IMortgageApplicationSpecification>().Object
                }
            };

            // Act
            var actual = sut.Equals(other);

            // Assert
            Assert.False(actual);
        }