Пример #1
0
        public void TestMatchWholeWordConstructor()
        {
            MatchWholeWord word = null;
            try
            {
                word = new MatchWholeWord("test");
            }
            catch
            {
                Assert.IsTrue(false, "The constructor threw an Exception");
            }
            Assert.AreEqual(word.Word, "test", "the constructor does not set the private field for 'Word'"); 

            try
            {
                word = new MatchWholeWord("test", true);
            }
            catch
            {
                Assert.IsTrue(false, "The constructor threw an Exception");
            }

            Assert.AreEqual(word.WholeWord, true, "The constructor does not set the 'WholeWord' property");

        }
Пример #2
0
        public override int GetHashCode()
        {
            var hash = 23;

            hash = hash * 31 + MatchCase.GetHashCode();
            hash = hash * 31 + MatchWholeWord.GetHashCode();
            hash = hash * 31 + IsRegex.GetHashCode();
            hash = hash * 31 + UseExcludeSettingsAndIgnoreFiles.GetHashCode();
            if (Query != null)
            {
                hash = hash * 31 + Query.GetHashCode();
            }
            if (WorkingDirectory != null)
            {
                hash = hash * 31 + WorkingDirectory.GetHashCode();
            }
            if (Include != null)
            {
                hash = hash * 31 + Include.GetHashCode();
            }
            if (Exclude != null)
            {
                hash = hash * 31 + Exclude.GetHashCode();
            }
            return(hash);
        }
Пример #3
0
        public void TestMatchWholeWordToString()
        {
            MatchWholeWord word = new MatchWholeWord("test", true);

            Assert.AreEqual(word.ToString(), "\"test\"", "ToString() does not quote the 'Word' correctly");

            word.WholeWord = false;

            Assert.AreEqual(word.ToString(), "test", "ToString() returns an incorrect value when 'WholeWord' is false");
        }
Пример #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = Index;
         hashCode = (hashCode * 397) ^ PageSize;
         hashCode = (hashCode * 397) ^ ShowEmpty.GetHashCode();
         hashCode = (hashCode * 397) ^ OnlySelected.GetHashCode();
         hashCode = (hashCode * 397) ^ Lang;
         hashCode = (hashCode * 397) ^ MatchWholeWord.GetHashCode();
         hashCode = (hashCode * 397) ^ (TextToFind != null ? TextToFind.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Category != null ? Category.GetHashCode() : 0);
         return(hashCode);
     }
 }
Пример #5
0
 protected bool Equals(GetPageParameters other)
 {
     return(Index == other.Index && PageSize == other.PageSize && ShowEmpty.Equals(other.ShowEmpty) && OnlySelected.Equals(other.OnlySelected) && Lang == other.Lang && MatchWholeWord.Equals(other.MatchWholeWord) && string.Equals(TextToFind, other.TextToFind) && string.Equals(Category, other.Category));
 }