예제 #1
0
    public void TestHashCodeOnEquivalentInstances() {
      StringSegment helloWorld1Segment = new StringSegment("hello world", 2, 7);
      StringSegment helloWorld2Segment = new StringSegment("hello world", 2, 7);

      Assert.AreEqual(
        helloWorld1Segment.GetHashCode(), helloWorld2Segment.GetHashCode()
      );
    }
예제 #2
0
    public void TestHashCodeOnDifferingInstances() {
      StringSegment helloWorldSegment = new StringSegment("hello world", 2, 7);
      StringSegment howAreYouSegment = new StringSegment("how are you", 1, 9);

      Assert.AreNotEqual(
        helloWorldSegment.GetHashCode(), howAreYouSegment.GetHashCode()
      );
    }