public void EqualsTestAnotherObject()
 {
     MatchResult mr1 = new MatchResult();
     mr1.StartIndex = 1;
     mr1.EndIndex = 2;
     mr1.Result = true;
     Assert.IsFalse(mr1.Equals("Test"));
 }
 public void EqualsTestSameMatchResult()
 {
     MatchResult mr1 = new MatchResult();
     mr1.StartIndex = 1;
     mr1.EndIndex = 2;
     mr1.Result = true;
     MatchResult mr2 = new MatchResult();
     mr2.StartIndex = 1;
     mr2.EndIndex = 2;
     mr2.Result = true;
     Assert.IsTrue(mr1.Equals(mr2));
 }
 public void EqualsTestDifferentMatchResult()
 {
     MatchResult mr1 = new MatchResult();
     mr1.StartIndex = 1;
     mr1.EndIndex = 2;
     mr1.Result = true;
     MatchResult mr2 = new MatchResult();
     mr2.StartIndex = 2;
     mr2.EndIndex = 2;
     mr2.Result = true;
     Assert.IsFalse(mr1.Equals(mr2));
 }
 public void EqualOperatorTest()
 {
     MatchResult mr1 = new MatchResult();
     mr1.StartIndex = 1;
     mr1.EndIndex = 2;
     mr1.Result = true;
     MatchResult mr2 = new MatchResult();
     mr2.StartIndex = 2;
     mr2.EndIndex = 2;
     mr2.Result = true;
     Assert.IsFalse(mr1 == mr2, "Equality operator fails when objects are different");
     mr2.StartIndex = 1;
     Assert.IsTrue(mr1 == mr2, "Equality operator fails when objects are same");
 }
 public MatchResult CheckForHardCodedString(string text, int selectionStart, int selectionEnd)
 {
     MatchResult result = new MatchResult();
     MatchCollection matches = this.literalRegex.Matches(text);
     foreach (Match match in matches)
     {
         if (match.Index <= selectionStart &&
             match.Index + match.Length >= selectionEnd)
         {
             result.Result = true;
             result.StartIndex = match.Index;
             result.EndIndex = match.Index + match.Length;
             break;
         }
     }
     return result;
 }