/// <summary> /// Check to see if the word is all ready contained in the list box. /// </summary> /// <param name="word">The word to be added to the list box.</param> /// <returns>True if no duplicate word found in the list box else false.</returns> /// <created>art2m,5/12/2019</created> /// <changed>art2m,5/12/2019</changed> private bool CheckListBoxForWord(string word) { this.duplicate = new List<string>(); if (this.lstWords.Items.Contains(word)) { { return false; } } foreach (var item in this.lstWords.Items) { this.duplicate.Add(item.ToString()); } if (!SpellingListClass.CheckDuplicateWord(this.duplicate, word)) { return false; } this.cboWord.Text = string.Empty; this.cboWord.Focus(); return true; }
/// <summary> /// Check to see if the word is all ready contained in the list box. /// </summary> /// <param name="word">The word to be added to the list box.</param> /// <returns>True if no duplicate word found in the list box else false.</returns> /// <created>art2m,5/12/2019</created> /// <changed>art2m,5/12/2019</changed> private bool CheckListBoxForWord(string word) { if (!SpellingListClass.CheckDuplicateWord(this.duplicate, word)) { return(false); } this.cboWord.Text = string.Empty; this.cboWord.Focus(); return(true); }
public void CheckDuplicateWord_ValidateWordAddedIsDuplicate() { // Arrange var duplicate = new List <string> { "find", "does", "friend", "mouse", "time", "Done", "Fan" }; const string Word = "does"; // Act var retVal = SpellingListClass.CheckDuplicateWord(duplicate, Word); // Assert Assert.IsTrue(retVal); }
public void CheckDuplicateWord_ValidateWordIsDuplicate_IgnoreCase() { var slc = new SpellingListClass(); // Arrange var duplicate = new List<string> { "find", "does", "friend", "mouse", "time", "Done", "Fan" }; const string Word = "Does"; // Act var retVal = slc.CheckDuplicateWord(duplicate, Word); // Assert Assert.IsTrue(retVal); }
public void CheckDuplicateWord_SymbolsInWord() { // Arrange var duplicate = new List <string> { "find", "does", "friend", "mouse", "time", "Done", "Fan" }; const string Word = "Do&es"; // Act var retVal = SpellingListClass.CheckDuplicateWord(duplicate, Word); // Assert Assert.IsFalse(retVal); }
public void CheckDuplicateWord_EmptyStringWithSpaces() { // Arrange var slc = new SpellingListClass(); var duplicate = new List <string> { "find", "does", "friend", "mouse", "time", "Done", "Fan" }; const string Word = " "; // Act var retVal = slc.CheckDuplicateWord(duplicate, Word); // Assert Assert.IsFalse(retVal); }
/// <summary> /// Check to see if the word is all ready contained in the list box. /// </summary> /// <param name="word">The word to be added to the list box.</param> /// <returns>True if no duplicate word found in the list box else false.</returns> /// <created>art2m,5/12/2019</created> /// <changed>art2m,5/12/2019</changed> private bool CheckListBoxForWord(string word) { this.duplicate = new List <string>(); var retVal = this.lstWords.Items.Contains(word) l if (!SpellingListClass.CheckDuplicateWord(this.duplicate, word)) { return(false); } this.cboWord.Text = string.Empty; this.cboWord.Focus(); return(true); }
/// <summary> /// Check to see if the word is all ready contained in the list box. /// </summary> /// <param name="word">The word to be added to the list box.</param> /// <returns>True if no duplicate word found in the list box else false.</returns> /// <created>art2m,5/12/2019</created> /// <changed>art2m,5/12/2019</changed> private bool CheckListBoxForWord(string word) { var slc = new SpellingListClass(); this.duplicate = new List <string>(); foreach (var item in this.lstWords.Items) { this.duplicate.Add(item.ToString()); } if (!slc.CheckDuplicateWord(this.duplicate, word)) { return(false); } this.cboWord.Text = string.Empty; this.cboWord.Focus(); return(true); }