예제 #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.");
        }
예제 #2
0
파일: Test_8_9.cs 프로젝트: jkrez/Interview
        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);
        }