Пример #1
0
        public void AreAnagrams_ContainNonAlphaNumeric_ThrowsArgumentException()
        {
            // arrange
            var anagramCheck = new Anagram();

            // acts & assert
            Assert.Throws <ArgumentException>(() => anagramCheck.AreAnagrams("a$", "a$"));
        }
Пример #2
0
        public void AreAnagrams_NullWord_ThrowsInvalidateArgumentException(string word1, string word2)
        {
            // arrange
            var anagramCheck = new Anagram();

            // act & assert
            Assert.Throws <ArgumentNullException>(() => anagramCheck.AreAnagrams(word1, word2));
        }
Пример #3
0
        public void AreAnagrams_SameStrings_ReturnsTrue()
        {
            // arrange
            var anagramCheck = new Anagram();

            // act
            var result = anagramCheck.AreAnagrams("abc", "abc");

            //assert
            Assert.True(result);
        }
Пример #4
0
        public void AreAnagrams_SameLettersDifferentLength_ReturnsFalse(string word1, string word2)
        {
            // arrange
            var anagramCheck = new Anagram(true);

            // act
            var result = anagramCheck.AreAnagrams(word1, word2);

            //assert
            Assert.False(result);
        }
Пример #5
0
        public void AreAnagrams_WordsWithLettersReversed_ReturnsTrue(string word1, string word2)
        {
            // arrange
            var anagramCheck = new Anagram();

            // act
            var result = anagramCheck.AreAnagrams(word1, word2);

            //assert
            Assert.True(result);
        }
Пример #6
0
        public void AreAnagrams_ShareNoLetters_ReturnsFalse(string word1, string word2)
        {
            // arrange
            var anagramCheck = new Anagram();

            // act
            var result = anagramCheck.AreAnagrams(word1, word2);

            //assert
            Assert.False(result);
        }
Пример #7
0
        public void AreAnagrams_SameWordsMixedCase_DefaultConstructor_ReturnsFalse(string word1, string word2)
        {
            // arrange
            var anagramCheck = new Anagram();

            // act
            var result = anagramCheck.AreAnagrams(word1, word2);

            //assert
            Assert.False(result);
        }
Пример #8
0
        public void AreAnagrams_AnagramDifferentCase_IgnoreCaseFalse_ReturnsFalse(string word1, string word2)
        {
            // arrange
            var anagramCheck = new Anagram(false);

            // act
            var result = anagramCheck.AreAnagrams(word1, word2);

            //assert
            Assert.False(result);
        }
Пример #9
0
        public void AreAnagrams_MismatchedWhitespace_ReturnsFalse(string word1, string word2)
        {
            // arrange
            var anagramCheck = new Anagram();

            // act
            var result = anagramCheck.AreAnagrams(word1, word2);

            //assert
            Assert.False(result);
        }
Пример #10
0
 public void Word1_IsRequired()
 {
     Assert.Throws <ArgumentException>(() => _anagram.AreAnagrams(string.Empty, "ABC"));
 }
Пример #11
0
 public void ReturnFalseForNullWords()
 {
     Assert.False(_anagram.AreAnagrams(null, "", 0));
     Assert.False(_anagram.AreAnagrams("", null, 0));
     Assert.False(_anagram.AreAnagrams(null, null, 0));
 }