IsIsogram() public static method

public static IsIsogram ( string word ) : bool
word string
return bool
        public void ShouldHoldFalseForWordEleven()
        {
            Isogram i = new Isogram();

            var actual   = i.IsIsogram("eleven");
            var expected = false;

            Assert.True(expected == actual);
        }
        public void ShouldHoldTrueForEmptyString()
        {
            Isogram i = new Isogram();

            var actual   = i.IsIsogram("");
            var expected = true;

            Assert.True(expected == actual);
        }
        public void ShouldHoldTrueForWordWithDuplicatedFHyphenSixyearold()
        {
            Isogram i = new Isogram();

            var actual   = i.IsIsogram("six-year-old");
            var expected = true;

            Assert.True(expected == actual);
        }
        public void ShouldHoldTrueForNameWhichIsSeperatedBySpaces()
        {
            Isogram i = new Isogram();

            var actual   = i.IsIsogram("Ros Eckler");
            var expected = true;

            Assert.True(expected == actual);
        }
        public void ShouldHoldTrueForWordWithHyphenThumbscrewJapingly()
        {
            Isogram i = new Isogram();

            var actual   = i.IsIsogram("thumbscrew-japingly");
            var expected = true;

            Assert.True(expected == actual);
        }
        public void ShouldHoldTrueForWordWithDuplicatedCharacterInMixedCaseAlphabet()
        {
            Isogram i = new Isogram();

            var actual   = i.IsIsogram("Alphabet");
            var expected = true;

            Assert.True(expected == actual);
        }
        public void ShouldHoldTrueForLongReportedEnglishWordLikeSubdermatoglyphic()
        {
            Isogram i = new Isogram();

            var actual   = i.IsIsogram("subdermatoglyphic");
            var expected = true;

            Assert.True(expected == actual);
        }
        public void ShouldHoldTrueForWordIsogramWithLowerCaseCharacters()
        {
            Isogram i = new Isogram();

            var actual   = i.IsIsogram("isogram");
            var expected = true;

            Assert.True(expected == actual);
        }
Exemplo n.º 9
0
        public void Isogram_IsIsogram_RandomTest()
        {
            var    randomTestStr = "";
            Random rnd           = new Random();
            var    isIsogram     = true;

            for (var i = 0; i < 100; i++)
            {
                var thisChar = rnd.Next(0, 99) < 50 ?
                               _lowers[(rnd.Next(0, _lowers.Length))]
                                : _uppers[(rnd.Next(0, _uppers.Length))];
                if (randomTestStr.ToUpper().Contains(thisChar.ToString().ToUpper()))
                {
                    isIsogram = false;
                }
                randomTestStr += thisChar;
            }

            Console.WriteLine(String.Format("Test string for Random Tests: {0}", randomTestStr));
            Assert.AreEqual(isIsogram, Isogram.IsIsogram(randomTestStr));
        }
Exemplo n.º 10
0
 public void Duplicated_character_in_the_middle()
 {
     Assert.False(Isogram.IsIsogram("accentor"));
 }
Exemplo n.º 11
0
 public void Isogram_with_duplicated_non_letter_character()
 {
     Assert.True(Isogram.IsIsogram("Hjelmqvist-Gryb-Zock-Pfund-Wax"));
 }
Exemplo n.º 12
0
 public void Word_with_duplicated_character_in_mixed_case()
 {
     Assert.False(Isogram.IsIsogram("Alphabet"));
 }
Exemplo n.º 13
0
 public void Word_with_one_duplicated_character()
 {
     Assert.False(Isogram.IsIsogram("eleven"));
 }
Exemplo n.º 14
0
 public void Same_first_and_last_characters()
 {
     Assert.False(Isogram.IsIsogram("angola"));
 }
Exemplo n.º 15
0
 public void Hypothetical_word_with_duplicated_character_following_hyphen()
 {
     Assert.False(Isogram.IsIsogram("thumbscrew-jappingly"));
 }
Exemplo n.º 16
0
 public void Word_with_one_duplicated_character_from_the_end_of_the_alphabet()
 {
     Assert.False(Isogram.IsIsogram("zzyzx"));
 }
Exemplo n.º 17
0
 public void Word_with_duplicated_character_in_mixed_case_lowercase_first()
 {
     Assert.False(Isogram.IsIsogram("alphAbet"));
 }
Exemplo n.º 18
0
 public void TestForDuplicateCharInDifferentCase()
 {
     Isogram.IsIsogram("Alphabet").Should().BeTrue();
 }
Exemplo n.º 19
0
 public void Isogram_with_duplicated_hyphen()
 {
     Assert.True(Isogram.IsIsogram("six-year-old"));
 }
Exemplo n.º 20
0
 public void TestForStringWithHyphen()
 {
     Isogram.IsIsogram("thumbscrew-japingly").Should().BeTrue();
 }
Exemplo n.º 21
0
 public void Isogram_with_only_lower_case_characters()
 {
     Assert.True(Isogram.IsIsogram("isogram"));
 }
Exemplo n.º 22
0
 public void TestForStringWithDuplicateHyphen()
 {
     Isogram.IsIsogram("six-year-old").Should().BeTrue();
 }
Exemplo n.º 23
0
 public void Longest_reported_english_isogram()
 {
     Assert.True(Isogram.IsIsogram("subdermatoglyphic"));
 }
Exemplo n.º 24
0
 public void TestForStringWithSpaces()
 {
     Isogram.IsIsogram("thumbscrew japingly").Should().BeTrue();
 }
Exemplo n.º 25
0
 public void Hypothetical_isogrammic_word_with_hyphen()
 {
     Assert.True(Isogram.IsIsogram("thumbscrew-japingly"));
 }
Exemplo n.º 26
0
 public void TestForEmptyString()
 {
     Isogram.IsIsogram("").Should().BeTrue();
 }
Exemplo n.º 27
0
 public void Made_up_name_that_is_an_isogram()
 {
     Assert.True(Isogram.IsIsogram("Emily Jung Schwartzkopf"));
 }
Exemplo n.º 28
0
 public bool Isogram_correctly_detects_isograms(string input)
 {
     return(Isogram.IsIsogram(input));
 }
Exemplo n.º 29
0
 public void Empty_string()
 {
     Assert.True(Isogram.IsIsogram(""));
 }
Exemplo n.º 30
0
 public void IsIsogram()
 {
     _isogram.IsIsogram("Dermatoglyphics").Should().BeTrue();
     _isogram.IsIsogram("aba").Should().BeFalse();
     _isogram.IsIsogram("moOse").Should().BeFalse();
 }