Beispiel #1
0
        public void TestGetHashCode()
        {
            var location1 = new TextLocation(1, 6);
            var location2 = new TextLocation(6, 1);
            var location3 = new TextLocation(1, 7);
            var location4 = new TextLocation(2, 6);
            var location5 = new TextLocation(1, 6);

            Assert.That(location1.GetHashCode(), Is.Not.EqualTo(location2.GetHashCode()));
            Assert.That(location1.GetHashCode(), Is.Not.EqualTo(location3.GetHashCode()));
            Assert.That(location1.GetHashCode(), Is.Not.EqualTo(location4.GetHashCode()));
            Assert.That(location2.GetHashCode(), Is.Not.EqualTo(location3.GetHashCode()));
            Assert.That(location2.GetHashCode(), Is.Not.EqualTo(location4.GetHashCode()));
            Assert.That(location3.GetHashCode(), Is.Not.EqualTo(location4.GetHashCode()));

            Assert.That(location1.GetHashCode(), Is.EqualTo(location5.GetHashCode()));
        }