Skip to content

Begin and End property setter should re-create Operator instance.#69

Closed
sudoudaisuke wants to merge 2 commits intojsakamoto:masterfrom
sudoudaisuke:master
Closed

Begin and End property setter should re-create Operator instance.#69
sudoudaisuke wants to merge 2 commits intojsakamoto:masterfrom
sudoudaisuke:master

Conversation

@sudoudaisuke
Copy link
Contributor

@sudoudaisuke sudoudaisuke commented Feb 22, 2021

Hello.
Begin and End property setter should re-create Operator instance. #68
Would you see this test code?

    [TestMethod]
    public void CtorTest_IPv4_BeginEndAddresses()
    {
        var range = new IPAddressRange(
            begin: IPAddress.Parse("192.168.0.0"),
            end: IPAddress.Parse("192.168.0.255"));
        range.Contains(IPAddress.Parse("192.168.0.10")).Is(true);
        range.Contains(IPAddress.Parse("192.169.0.10")).Is(false);
    }
    // error IPAddressRange 4.1.2
    [TestMethod]
    public void CtorTest_IPv4_BeginEndAddresses_ObjectInitializer()
    {
        var range = new IPAddressRange
        {
            Begin = IPAddress.Parse("192.168.0.0"),
            End = IPAddress.Parse("192.168.0.255")
        };
        range.Contains(IPAddress.Parse("192.168.0.10")).Is(true);
        range.Contains(IPAddress.Parse("192.169.0.10")).Is(false);
    }

Add object initializer test
Create Operator instance if Begin or End property was set.
@jsakamoto
Copy link
Owner

@sudoudaisuke Thank you for your contribution!

But I'm sorry, coincidentally, I resolved it too in my way during you are also doing that...!

Of course, your implementation is also very well!

However, I considered other invalid cases such as "Begin" is IPv4 and "End" is IPv6, so I decided that I take my solution.

Again, thank you for your effort!

@jsakamoto jsakamoto closed this Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants