Exemple #1
0
        public void TestAnagram()
        {
            Anagram anagram = new Anagram();

            string wordFirst  = "joseph";
            string wordSecond = "hespoj";

            Assert.AreEqual(true, anagram.IsAnagram(wordFirst, wordSecond));
        }
        public void TestIsAnagramWithOneString()
        {
            string one = "hello";
            string two = "";

            bool output = false;

            Assert.AreEqual(output, Anagram.IsAnagram(one, two));
        }
        public void TestIsAnagramWithSpace()
        {
            string one = "hello";
            string two = "oll eh";

            bool output = true;

            Assert.AreEqual(output, Anagram.IsAnagram(one, two));
        }
        public void TestIsAnagramWithUpperAndLowerCase()
        {
            string one = "Hello";
            string two = "oLleh";

            bool output = true;

            Assert.AreEqual(output, Anagram.IsAnagram(one, two));
        }
Exemple #5
0
        public void Check_CasaAnagrams()
        {
            string path = @"E:\Proyectos\Kata\Anagram\file.txt";

            string data   = "casa";
            string result = "aacs";

            var    anagram = new Anagram(path);
            string helper  = anagram.OrderedWord(data);

            Assert.AreEqual(result, helper);
        }
Exemple #6
0
 public void TwoNullTextsAreRejected()
 {
     try
     {
         Anagram.IsAnagram(null, null);
         Assert.Fail("expected exception not thrown");
     }
     catch (ArgumentNullException ex)
     {
         Assert.AreEqual("text1", ex.ParamName);
     }
 }
Exemple #7
0
 public void NullText2IsRejected()
 {
     try
     {
         Anagram.IsAnagram("valid", null);
         Assert.Fail("expected exception not thrown");
     }
     catch (ArgumentNullException ex)
     {
         Assert.AreEqual("text2", ex.ParamName);
     }
 }
Exemple #8
0
        private static void AssertNullTextIsRejected(string[] example)
        {
            var text1 = example[0];
            var text2 = example[1];

            try
            {
                Anagram.IsAnagram(text1, text2);
                Assert.Fail("expected exception not thrown");
            }
            catch (ArgumentNullException ex)
            {
                Assert.AreEqual("text" + (text1 == null ? "1" : "2"), ex.ParamName);
            }
        }
Exemple #9
0
        public void ShouldLettersBeAnagrams(string a, string b)
        {
            var anagram = new Anagram();

            anagram.IsAnagram(a, b).ShouldBe(true);
        }
Exemple #10
0
        public void ShouldWordsNotBeAnagrams(string a, string b)
        {
            var anagram = new Anagram();

            anagram.IsAnagram(a, b).ShouldBe(false);
        }
Exemple #11
0
 public void IdenticalTextWithSpacesIsNotAnAnagram()
 {
     Assert.IsFalse(Anagram.IsAnagram("same but with spaces", "same but with spaces"));
 }
Exemple #12
0
 public void IdenticalShortTextIsNotAnAnagram()
 {
     Assert.IsFalse(Anagram.IsAnagram("same", "same"));
 }
Exemple #13
0
 public void AssertIdenticalTextIsNotAnAnagram(string same)
 {
     Assert.IsFalse(Anagram.IsAnagram(same, same));
 }