Пример #1
0
    public void EqualsTest3(string?inp1, string?inp2, bool expected)
    {
        var strip1 = new Strip(inp1, false);
        var strip2 = new Strip(inp2, false);

        Assert.AreEqual(expected, strip1.Equals(strip2));

        // Test it twice!!
        Assert.AreEqual(expected, strip1.Equals(strip2));

        Assert.AreEqual(expected, Strip.Equals(inp1, inp2, true));

        if (expected)
        {
            int hashCode = strip1.GetHashCode();

            Assert.AreEqual(hashCode, strip2.GetHashCode());
            Assert.AreEqual(hashCode, strip1.GetHashCode());
        }
    }
Пример #2
0
 public int GetHashCode(PhoneNumber?obj) => Strip.GetHashCode(obj?.Value);
 public void GetHashCodeTest2() => Assert.AreEqual(PhoneNumberComparer.Instance.GetHashCode(null), Strip.GetHashCode(null));
    public void GetHashCodeTest1()
    {
        var p1 = new PhoneNumber("hi");

        Assert.AreEqual(PhoneNumberComparer.Instance.GetHashCode(p1), Strip.GetHashCode(p1.Value));
    }