public void TestToString() { StringSegment helloWorldSegment = new StringSegment("hello world", 4, 3); Assert.AreEqual("o w", helloWorldSegment.ToString()); }
public void TestInequalityOnDifferingInstances() { StringSegment helloWorldSegment = new StringSegment("hello world", 2, 7); StringSegment howAreYouSegment = new StringSegment("how are you", 1, 9); Assert.IsTrue(helloWorldSegment != howAreYouSegment); }
public void TestInequalityOnEquivalentInstances() { StringSegment helloWorld1Segment = new StringSegment("hello world", 2, 7); StringSegment helloWorld2Segment = new StringSegment("hello world", 2, 7); Assert.IsFalse(helloWorld1Segment != helloWorld2Segment); }
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() ); }
public void TestEqualsOnNull() { StringSegment helloWorldSegment = new StringSegment("hello world", 2, 7); Assert.IsFalse( helloWorldSegment.Equals(null) ); }
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() ); }
public void TestCountProperty() { StringSegment testSegment = new StringSegment("hello", 1, 3); Assert.AreEqual(3, testSegment.Count); }
public void TestOffsetProperty() { StringSegment testSegment = new StringSegment("hello", 1, 3); Assert.AreEqual(1, testSegment.Offset); }
public void TestTextProperty() { StringSegment testSegment = new StringSegment("hello", 1, 3); Assert.AreEqual("hello", testSegment.Text); }
/// <summary> /// Determines whether the specified <see cref="StringSegment" /> structure is equal /// to the current instance /// </summary> /// <returns> /// True if the specified <see cref="StringSegment" /> structure is equal to the /// current instance; otherwise, false /// </returns> /// <param name="other"> /// The <see cref="StringSegment" /> structure to be compared with the current instance /// </param> public bool Equals(StringSegment other) { return (other.text == this.text) && (other.offset == this.offset) && (other.count == this.count); }