public void Eliminate_anagrams_with_same_checksum() { var detector = new Anagram("mass"); var words = new[] { "last" }; var results = new string[0]; Assert.Equal(detector.Match(words), results); }
public void Does_not_confuse_different_duplicates() { var detector = new Anagram("galea"); var words = new[] { "eagle" }; var results = new string[0]; Assert.Equal(detector.Match(words), results); }
public void Detect_simple_anagram() { var detector = new Anagram("ant"); var words = new[] { "tan", "stand", "at" }; var results = new[] { "tan" }; Assert.That(detector.Match(words), Is.EquivalentTo(results)); }
public void Eliminate_anagram_subsets() { var detector = new Anagram("good"); var words = new[] { "dog", "goody" }; var results = new string[0]; Assert.Equal(detector.Match(words), results); }
public void No_matches() { var detector = new Anagram("diaper"); var words = new[] { "hello", "world", "zombies", "pants" }; var results = new string[0]; Assert.Equal(detector.Match(words), results); }
public void Detect_multiple_anagrams() { var detector = new Anagram("master"); var words = new[] { "stream", "pigeon", "maters" }; var results = new[] { "maters", "stream" }; Assert.Equal(detector.Match(words), results); }
public void Detect_simple_anagram() { var detector = new Anagram("ant"); var words = new[] { "tan", "stand", "at" }; var results = new[] { "tan" }; Assert.Equal(detector.Match(words), results); }
public void Constructor_WordAsParameter_WordAdded() { String word = "вертикаль"; var anagram = new Anagram(word); Assert.IsTrue(anagram.Count() == 1 && anagram.Contains(word)); }
public void Identical_word_is_not_anagram() { var detector = new Anagram("corn"); var words = new[] { "corn", "dark", "Corn", "rank", "CORN", "cron", "park" }; var results = new[] { "cron" }; Assert.Equal(detector.Match(words), results); }
public void Constructor_WordAsParameter_KeyDefined() { String word = "вертикаль"; var anagram = new Anagram(word); Assert.AreEqual(anagram.Key, Anagram.CreateKey(word)); }
public void Anagrams_are_case_insensitive() { var detector = new Anagram("Orchestra"); var words = new[] { "cashregister", "Carthorse", "radishes" }; var results = new[] { "Carthorse" }; Assert.Equal(detector.Match(words), results); }
public void Detect_anagrams() { var detector = new Anagram("allergy"); var words = new[] { "gallery", "ballerina", "regally", "clergy", "largely", "leading" }; var results = new[] { "gallery", "largely", "regally" }; Assert.Equal(detector.Match(words), results); }
public ActionResult Output(string word, string words) { Anagram myLetterVariable = new Anagram(word, words); myLetterVariable.SetWord(word); myLetterVariable.SetWords(words); return(View(myLetterVariable)); }
public void Anagrams_are_case_insensitive() { var detector = new Anagram("Orchestra"); var words = new[] { "cashregister", "Carthorse", "radishes" }; var results = new[] { "Carthorse" }; Assert.That(detector.Match(words), Is.EquivalentTo(results)); }
public void Eliminate_anagram_subsets() { var detector = new Anagram("good"); var words = new[] { "dog", "goody" }; var results = new string[0]; Assert.That(detector.Match(words), Is.EquivalentTo(results)); }
public void No_matches() { var detector = new Anagram("diaper"); var words = new[] { "hello", "world", "zombies", "pants" }; var results = new string[0]; Assert.That(detector.Match(words), Is.EquivalentTo(results)); }
public void Detects_two_anagrams() { var candidates = new[] { "stream", "pigeon", "maters" }; var sut = new Anagram("master"); var expected = new[] { "stream", "maters" }; Assert.Equal(expected, sut.FindAnagrams(candidates)); }
public void Does_not_confuse_different_duplicates() { var detector = new Anagram("galea"); var words = new[] { "eagle" }; var results = new string[0]; Assert.That(detector.Match(words), Is.EquivalentTo(results)); }
public void Detect_multiple_anagrams() { var detector = new Anagram("master"); var words = new[] { "stream", "pigeon", "maters" }; var results = new[] { "maters", "stream" }; Assert.That(detector.Match(words), Is.EquivalentTo(results)); }
public void Detects_anagrams_using_case_insensitive_possible_matches() { var candidates = new[] { "cashregister", "Carthorse", "radishes" }; var sut = new Anagram("orchestra"); var expected = new[] { "Carthorse" }; Assert.Equal(expected, sut.FindAnagrams(candidates)); }
public void Detects_multiple_anagrams_with_different_case() { var candidates = new[] { "Eons", "ONES" }; var sut = new Anagram("nose"); var expected = new[] { "Eons", "ONES" }; Assert.Equal(expected, sut.FindAnagrams(candidates)); }
public void Detects_three_anagrams() { var candidates = new[] { "gallery", "ballerina", "regally", "clergy", "largely", "leading" }; var sut = new Anagram("allergy"); var expected = new[] { "gallery", "regally", "largely" }; Assert.Equal(expected, sut.FindAnagrams(candidates)); }
public void Detects_anagram() { var candidates = new[] { "enlists", "google", "inlets", "banana" }; var sut = new Anagram("listen"); var expected = new[] { "inlets" }; Assert.Equal(expected, sut.FindAnagrams(candidates)); }
// GET: Anagram //public ActionResult Search() //{ // var anagram = new Anagram(); // anagram.FindSecretPhrase("poultry outwits ants", "4624d200580677270a54ccff86b9610e"); // return View(anagram); //} public ActionResult Search(string hintPhrase, string md5HashKey) { var anagram = new Anagram(); //anagram.FindSecretPhrase(hintPhrase, md5HashKey); anagram.FindSecretPhrase("poultry outwits ants", "4624d200580677270a54ccff86b9610e"); return(View(anagram)); }
public void Detects_anagrams_case_insensitively() { var candidates = new[] { "cashregister", "Carthorse", "radishes" }; var sut = new Anagram("Orchestra"); var expected = new[] { "Carthorse" }; Assert.Equal(expected, sut.Anagrams(candidates)); }
public void Detects_simple_anagram() { var candidates = new[] { "tan", "stand", "at" }; var sut = new Anagram("ant"); var expected = new[] { "tan" }; Assert.Equal(expected, sut.Anagrams(candidates)); }
public void Words_other_than_themselves_can_be_anagrams() { var candidates = new[] { "Listen", "Silent", "LISTEN" }; var sut = new Anagram("LISTEN"); var expected = new[] { "Silent" }; Assert.Equal(expected, sut.FindAnagrams(candidates)); }
public void GetSetWordToCompare_SetsWordToCompare_String() { Anagram testAnagram = new Anagram(); string word = "test"; testAnagram.SetWordToCompare(word); Assert.AreEqual(word, testAnagram.GetWordToCompare()); }
public void Does_not_detect_identical_words() { var candidates = new[] { "corn", "dark", "Corn", "rank", "CORN", "cron", "park" }; var sut = new Anagram("corn"); var expected = new[] { "cron" }; Assert.Equal(expected, sut.Anagrams(candidates)); }
public void Eliminate_anagrams_with_same_checksum() { var detector = new Anagram("mass"); var words = new[] { "last" }; var results = new string[0]; Assert.That(detector.Match(words), Is.EquivalentTo(results)); }
public void CharactersInWord_WordTurnedIntoCharArray_CharArray() { Anagram testAnagram = new Anagram(); string word = "noob"; char[] wordSplit = { 'n', 'o', 'o', 'b' }; CollectionAssert.AreEqual(wordSplit, testAnagram.CharactersInWord(word)); }
public void Identical_word_is_not_anagram() { var detector = new Anagram("corn"); var words = new[] { "corn", "dark", "Corn", "rank", "CORN", "cron", "park" }; var results = new[] { "cron" }; Assert.That(detector.Match(words), Is.EquivalentTo(results)); }
public void GetSetWordMatches_GetsSetsWordMatches_String() { Anagram testAnagram = new Anagram(); string word = "test"; testAnagram.SetWordMatches(word); Assert.AreEqual(word, testAnagram.GetWordMatches()[0]); }
public void Detect_anagrams() { var detector = new Anagram("allergy"); var words = new[] { "gallery", "ballerina", "regally", "clergy", "largely", "leading" }; var results = new[] { "gallery", "largely", "regally" }; Assert.That(detector.Match(words), Is.EquivalentTo(results)); }
public void IsWords_Sorted() { //Arrange string word2 = "aaasnm"; string name = "manasa"; Assert.AreEqual("IsAnagram", Anagram.IsAnagram(name, word2)); }
public void TryAdd_ExistingAnagram_FalseReturned() { String word = "вертикаль"; var anagram = new Anagram(word); Boolean value = anagram.TryAdd(word); Assert.IsFalse(value); }
public void IsAnagram_SingleWord_FalseReturned() { String word = "вертикаль"; var anagram = new Anagram(word); Boolean value = anagram.IsAnagram; Assert.IsFalse(value); }
public void GetWord_ReturnsWord_String() { string word = "dear"; Anagram anagram = new Anagram(word); string result = Anagram.Word; Assert.AreEqual(word, result); }
public IActionResult CheckAnagram([FromBody] Anagram a) { reader.ReadFile(configuration["dictonaryFileName"]); if (AnagramLibrary.AnagramLibrary.CheckToWords(a.W1, a.W2)) { return(Ok()); } return(BadRequest()); }
public void AddAnagram_AddsWordsToMatchList_String() { Anagram testAnagram = new Anagram(); string word = "gandalf"; testAnagram.SetWordToCompare(word); testAnagram.AddAnagram(); Assert.AreEqual(word, testAnagram.GetWordMatches()[0]); }
public void SortAndReturnWord_CharsAreSortedAndReturned_CharArray() { Anagram testAnagram = new Anagram(); string word = "frodo"; char[] splitWord = word.ToCharArray(); Array.Sort(splitWord); CollectionAssert.AreEqual(splitWord, testAnagram.SortAndReturnChars(word)); }
public void CheckLettersAreEqual_TestEachLetterIsEqual_True() { Anagram testAnagram = new Anagram(); char letterOne = 'f'; char letterTwo = 'f'; testAnagram.CheckLettersAreEqual(letterOne, letterTwo); Assert.AreEqual(true, testAnagram.GetSameLetters()); }
public List <char []> getAllAnagrams(string initial) { Stack <char> stack = new Stack <char>(); Anagram anagram = new Anagram(); composeAnagrams(initial, stack, anagram); return(anagrams); }
public void IsAnagram_MultipleWords_TrueReturned() { String word = "вертикаль", wordToAdd = "кильватер"; var anagram = new Anagram(word); anagram.TryAdd(wordToAdd); Boolean value = anagram.IsAnagram; Assert.IsTrue(value); }
public void ConfirmAreAnagrams() { var careWord = new Anagram("CARE"); var raceWord = new Anagram("RACE"); careWord.Key.Should().Be("ACER"); raceWord.Key.Should().Be("ACER"); var areAnagrams = AreAnagrams(careWord, raceWord); areAnagrams.Should().BeTrue(); }
public void TryAdd_NotAnagram_FalseReturned() { String word = "вертикаль", wordToAdd = "король"; var anagram = new Anagram(word); Boolean value = anagram.TryAdd(wordToAdd); Assert.IsFalse(value); }
public void TryAdd_NewAnagram_AnagramAdded() { String word = "вертикаль", wordToAdd = "кильватер"; var anagram = new Anagram(word); Boolean value = anagram.TryAdd(wordToAdd); Assert.IsTrue(anagram.Count() == 2 && anagram.Contains(word) && anagram.Contains(wordToAdd)); }
public void TryAdd_ExistingAnagram_NoChangesMade() { String word = "вертикаль"; var anagram = new Anagram(word); Boolean value = anagram.TryAdd(word); Assert.IsTrue(anagram.Count() == 1 && anagram.Contains(word)); }
private static bool AreAnagrams(Anagram first, Anagram second) { return first.Key == second.Key && !string.IsNullOrEmpty(first.Key); }