Example #1
0
        public void GenerateAllParenthesisCombosTest(string[] expectedCombos, int nPairs)
        {
            // Act
            List <string> resultCombos = Question_8_9.GenerateAllParenthesisCombos(nPairs);

            // Assert
            Assert.AreEqual(expectedCombos.Length, resultCombos.Count, "Number of parenthesis combos do not match.");
            Assert.IsTrue(expectedCombos.OrderBy(x => x).SequenceEqual(resultCombos.OrderBy(x => x)), "Parenthesis combos don't match.");
        }
Example #2
0
        private static void Validate(int n)
        {
            var result = Question_8_9.GetParenthesis(n);
            var set    = new HashSet <string>();

            foreach (var str in result)
            {
                set.Add(str);
            }

            Assert.AreEqual(set.Count, result.Count);
        }