Exemple #1
0
        public void GroupAnagramSuccess()
        {
            string[] input = new string[] { "eat", "tea", "tan", "ate", "nat", "bat" };

            var expectedResult = new List <IList <string> >()
            {
                new List <string>()
                {
                    "eat", "tea", "ate"
                },
                new List <string>()
                {
                    "tan", "nat"
                },
                new List <string>()
                {
                    "bat"
                }
            };



            var result = new GroupAnagramsSolution().GroupAnagrams(input);

            var isEqual = CollectionsAreEqual.AreEqualListOfLists(result, expectedResult);

            Assert.IsTrue(isEqual);
        }
Exemple #2
0
        public void Test1()
        {
            var list         = new[] { "eat", "tea", "tan", "ate", "nat", "bat" };
            var expectedList = new[] { new[] { "bat" }, new[] { "nat", "tan" }, new[] { "ate", "eat", "tea" } };

            var result = new GroupAnagramsSolution().GroupAnagrams(list);

            CollectionAssert.AreEquivalent(expectedList, result);
        }