public void ValidPangramTooLong() { Pangram pangram = new Pangram(); Assert.AreEqual(pangram.IsPangram("We promptly judged antique ivory buckles for the prize" + "We promptly judged antique ivory buckles for the prize We promptly judged antique ivory buckles for the prize"), 0); }
public void InValidPangramTooShort() { Pangram pangram = new Pangram(); //Pass in nothing Assert.AreEqual(pangram.IsPangram(String.Empty), 0); }
public void TestMethodMixnMatch() { //Arange var sentenceTest = "abcdeFghijKlmnopqrstuvWXYZ"; //Act var isPangram = Pangram.PangramSolution(sentenceTest); //Assert Assert.AreEqual(isPangram, "pangram"); }
public void TestMethod3AllLower() { //Arange var sentenceTest = "abcdefghijklmnopqrstuvwxyz"; //Act var isPangram = Pangram.PangramSolution(sentenceTest); //Assert Assert.AreEqual(isPangram, "pangram"); }
public void TestMethod2AllUpper() { //Arange var sentenceTest = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //Act var isPangram = Pangram.PangramSolution(sentenceTest); //Assert Assert.AreEqual(isPangram, "pangram"); }
public void TestMethod1() { //Arange var sentenceTest = "We promptly judged antique ivory buckles for the next prize"; //Act var isPangram = Pangram.PangramSolution(sentenceTest); //Assert Assert.AreEqual(isPangram, "pangram"); }
public void LetterDictionaryLoadsWithAllLettersAndZeroCount() { Pangram pangram = new Pangram(); var dictionary = pangram.LoadDictionary(); // There are 26 letters in the dictionary Assert.AreEqual(dictionary.Count, 26); // For each letter we should have a count of zero foreach (var letterCount in dictionary) { Assert.AreEqual(letterCount.Value, 0); } }
public static bool IsPangram(string input) { HashSet <char> uniqueLetters = new HashSet <char>(); foreach (char c in input.ToLower()) { if (Pangram.IsAlpha(c)) { uniqueLetters.Add(c); } } if (uniqueLetters.Count == 26) { return(true); } return(false); }
public void Case_insensitive() { Assert.False(Pangram.IsPangram("the quick brown fox jumps over with lazy FX")); }
public void Missing_letters_replaced_by_numbers() { Assert.False(Pangram.IsPangram("7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog")); }
public void With_underscores() { Assert.True(Pangram.IsPangram("the_quick_brown_fox_jumps_over_the_lazy_dog")); }
public void Missing_the_letter_x() { Assert.False(Pangram.IsPangram("a quick movement of the enemy will jeopardize five gunboats")); }
public void Perfect_lower_case() { Assert.True(Pangram.IsPangram("abcdefghijklmnopqrstuvwxyz")); }
public void Pangram_with_non_ascii_characters() { var input = "Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich."; Assert.That(Pangram.IsPangram(input), Is.EqualTo(true)); }
public void Missing_letters_replaced_by_numbers() { var input = "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog"; Assert.That(Pangram.IsPangram(input), Is.EqualTo(false)); }
public void Empty_sentence() { var input = ""; Assert.That(Pangram.IsPangram(input), Is.EqualTo(false)); }
public HttpResponseMessage PostPangram([FromBody]string sentence) { CreatePangramResponse createPangramResponse = new CreatePangramResponse(); createPangramResponse.isPangram = false; IRepository<Pangram> _pangramRepo = new MongoRepository<Pangram>(); if (!String.IsNullOrEmpty(sentence)) { var pangram = new Pangram(sentence); if (pangram.isPangram) { var pangrams = _pangramRepo.Select(p => p).ToList(); var checkForSamePangramInRepo = pangrams.AsEnumerable().Where(p => p.Sentence == sentence).Select(p => p.Sentence).ToList(); if (checkForSamePangramInRepo.Count() == 0) { _pangramRepo.Add(pangram); } createPangramResponse.isPangram = true; } } return new HttpResponseMessage() { Content = new JsonContent2( createPangramResponse ) }; }
public void Pangram_with_mixed_case_and_punctuation() { var input = "\"Five quacking Zephyrs jolt my wax bed.\""; Assert.That(Pangram.IsPangram(input), Is.EqualTo(true)); }
public void Upper_and_lower_case_versions_of_the_same_character_should_not_be_counted_separately() { Assert.False(Pangram.IsPangram("the quick brown fox jumps over with lazy FX")); }
public void Pangram_in_alphabet_other_than_ascii() { var input = "Широкая электрификация южных губерний даст мощный толчок подъёму сельского хозяйства."; Assert.That(Pangram.IsPangram(input), Is.EqualTo(false)); }
public void Sentence_empty() { Assert.False(Pangram.IsPangram("")); }
public void Only_lower_case() { Assert.True(Pangram.IsPangram("the quick brown fox jumps over the lazy dog")); }
public void Pangram_with_only_lower_case() { var input = "the quick brown fox jumps over the lazy dog"; Assert.That(Pangram.IsPangram(input), Is.EqualTo(true)); }
public void Missing_the_letter_h() { Assert.False(Pangram.IsPangram("five boxing wizards jump quickly at it")); }
public void Missing_character_x() { var input = "a quick movement of the enemy will jeopardize five gunboats"; Assert.That(Pangram.IsPangram(input), Is.EqualTo(false)); }
public void With_numbers() { Assert.True(Pangram.IsPangram("the 1 quick brown fox jumps over the 2 lazy dogs")); }
public void Another_missing_character_x() { var input = "the quick brown fish jumps over the lazy dog"; Assert.That(Pangram.IsPangram(input), Is.EqualTo(false)); }
public void Mixed_case_and_punctuation() { Assert.True(Pangram.IsPangram("\"Five quacking Zephyrs jolt my wax bed.\"")); }
public void Pangram_with_underscores() { var input = "the_quick_brown_fox_jumps_over_the_lazy_dog"; Assert.That(Pangram.IsPangram(input), Is.EqualTo(true)); }
public void Empty_sentence() { Assert.False(Pangram.IsPangram("")); }
public void Pangram_with_numbers() { var input = "the 1 quick brown fox jumps over the 2 lazy dogs"; Assert.That(Pangram.IsPangram(input), Is.EqualTo(true)); }