public void ComparisonTests(string smallers, string largers)
    {
        IpAddressNetworkV4 smaller = (IpAddressNetworkV4)smallers;
        IpAddressNetworkV4 larger  = (IpAddressNetworkV4)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();
    }
    public void EqualTests(string lefts, string rights)
    {
        IpAddressNetworkV4 left  = (IpAddressNetworkV4)lefts;
        IpAddressNetworkV4 right = (IpAddressNetworkV4)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);
    }
Пример #3
0
 protected override int Compare(IpAddressNetworkV4 network, IpAddressNetworkV4 other) => network.CompareTo(other);