示例#1
0
        public void FindUsingPrimeNumberHashingEmptyListIfNull()
        {
            var anagram = new Anagram(null);

            var result = anagram.FindUsingPrimeNumberHashing();

            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.Count());
        }
示例#2
0
        public void EmptyListIfNull()
        {
            var anagram = new Anagram(null);

            var result = anagram.FindUsingSorting();

            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.Count());
        }
示例#3
0
        public void FindUsingPrimeNumberHashingOneAnagram()
        {
            var anagram = new Anagram(new[] { "word", "drwo" });

            var result = anagram.FindUsingPrimeNumberHashing();

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Count());
            Assert.AreEqual(2, result.ElementAt(0).Count());
            Assert.AreEqual("word", result.ElementAt(0).ElementAt(0));
            Assert.AreEqual("drwo", result.ElementAt(0).ElementAt(1));
        }
示例#4
0
        public void OneWord()
        {
            var anagram = new Anagram(new[] { "word" });

            var result = anagram.FindUsingSorting();

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Count());
            Assert.AreEqual(1, result.ElementAt(0).Count());
            Assert.AreEqual("word", result.ElementAt(0).ElementAt(0));
        }
示例#5
0
        public void OneAnagramMixedOrder()
        {
            var anagram = new Anagram(new[] { "word", "sdsad", "drwo" });

            var result = anagram.FindUsingSorting();

            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Count());
            Assert.AreEqual(2, result.ElementAt(0).Count());
            Assert.AreEqual("word", result.ElementAt(0).ElementAt(0));
            Assert.AreEqual("drwo", result.ElementAt(0).ElementAt(1));
            Assert.AreEqual(1, result.ElementAt(1).Count());
            Assert.AreEqual("sdsad", result.ElementAt(1).ElementAt(0));
        }
示例#6
0
        public void MultipleAnagram()
        {
            var anagram = new Anagram(new[] { "word", "wdro", "drwo" });

            var result = anagram.FindUsingSorting();

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Count());
            Assert.AreEqual(3, result.ElementAt(0).Count());
            Assert.AreEqual("word", result.ElementAt(0).ElementAt(0));
            Assert.AreEqual("wdro", result.ElementAt(0).ElementAt(1));
            Assert.AreEqual("drwo", result.ElementAt(0).ElementAt(2));
        }