public void AddSynonyms_MustInsertAnyStrings_WithNoException(string s1, string s2, string s3) { IEnumerable <string> strings = new List <string> { s1, s2, s3 }; var excep = Record.Exception(() => thesaurus.AddSynonyms(strings)); Assert.Null(excep); }
public void AddSynonyms(string testWord) { List <string> synonymsInput = new List <string>(); List <string> synonymsOutput = new List <string>(); // All words must be in lower case only for the comparison, because the AddSynonyms-function converts the words to lower case // before storing to database to avoid duplicates. So, it is possible to use upper case letters when storing to database but they will be converted // to lower case testWord = testWord.ToLower(); synonymsInput.Add(testWord); int amountOfSynonyms = 4; for (int i = 1; i < amountOfSynonyms; i++) { synonymsInput.Add(testWord + i); } mockObject.AddSynonyms(synonymsInput); synonymsOutput = (List <string>)mockObject.GetSynonyms(testWord); // synonymsOutput + testWord should be the same as synonymsInput synonymsOutput.Add(testWord); result = Compare(synonymsInput, synonymsOutput); Assert.True(result.Value, result.Message); }
public void AddSynonymsOneAddition() { var inputList = new List <string> { "C#" }; _thesaurus.AddSynonyms(inputList); var words = _thesaurus.GetWords(); var synonyms = _thesaurus.GetSynonyms(inputList[0]); Assert.Equal(1, words.Count()); Assert.Equal(0, synonyms.Count()); Assert.Contains("C#", words); Assert.Contains(inputList[0], words.ToList()[0]); Assert.Equal(inputList, words); // Order is important }