コード例 #1
0
    public void ComparisonTests(string smallers, string largers)
    {
        IpAddressV4 smaller = (IpAddressV4)smallers;
        IpAddressV4 larger  = (IpAddressV4)largers;

        (smaller < larger).Should().BeTrue();
        (smaller <= larger).Should().BeTrue();
        (larger > smaller).Should().BeTrue();
        (larger >= smaller).Should().BeTrue();

        smaller.CompareTo(larger).Should().BeNegative();
        larger.CompareTo(smaller).Should().BePositive();
    }
コード例 #2
0
    public void EqualTests(string lefts, string rights)
    {
        IpAddressV4 left  = (IpAddressV4)lefts;
        IpAddressV4 right = (IpAddressV4)rights;

        (left < right).Should().BeFalse();
        (left <= right).Should().BeTrue();
        (left == right).Should().BeTrue();
        (right > left).Should().BeFalse();
        (right >= left).Should().BeTrue();
        (right == left).Should().BeTrue();

        left.CompareTo(right).Should().Be(0);
        right.CompareTo(left).Should().Be(0);
    }