コード例 #1
0
        /// <inheritdoc />
        public override bool Equals(object?other)
        {
            if (other is null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (other is Point <TAlgebraicNumber> point)
            {
                return(_calculator.AreEqual(X, point.X) &&
                       _calculator.AreEqual(Y, point.Y));
            }

            return(false);
        }
コード例 #2
0
        public void When_Numbers_Are_Equal_Then_AreEqual_Should_Return_Expected_Result(
            double doubleNumber1, double doubleNumber2, bool number1EqualsNumber2Expectation)
        {
            // Arrange
            var number1 = _calculator.FromDouble(doubleNumber1);
            var number2 = _calculator.FromDouble(doubleNumber2);

            // Act
            var number1EqualsNumber2 = _calculator.AreEqual(number1, number2);

            // Assert
            number1EqualsNumber2.Should().Be(number1EqualsNumber2Expectation);
        }