コード例 #1
0
        public void Equals__Should_Ignore_Trailing_Zeroes()
        {
            var left  = new Money18(42, 1);
            var right = new Money18(420, 2);

            left.Equals(right)
            .Should()
            .BeTrue();
        }
コード例 #2
0
        public void Equals__Integer_Value_Passed__Return_Correct_Result()
        {
            var money = new Money18(42, 0);

            (money == 42).Should().BeTrue();
            (money != 41).Should().BeTrue();

            (42 == money).Should().BeTrue();
            (41 != money).Should().BeTrue();

            money
            .Equals(42)
            .Should()
            .BeTrue();

            money
            .Equals(41)
            .Should()
            .BeFalse();
        }
コード例 #3
0
        public void Equals__Decimal_Value_Passed__Return_Correct_Result()
        {
            var money = new Money18(42, 0);

            (money == 42m).Should().BeTrue();
            (money != 41m).Should().BeTrue();

            (42m == money).Should().BeTrue();
            (41m != money).Should().BeTrue();

            money
            .Equals(42m)
            .Should()
            .BeTrue();

            money
            .Equals(41m)
            .Should()
            .BeFalse();
        }