Ejemplo n.º 1
0
        public void Can_Validate_Brackets()
        {
            // Arrange
            BracketValidator b = new BracketValidator();
            bool             trueCase;
            bool             falseCase;

            // Act
            trueCase  = b.Validate("()[]{}([{}])({[]})");
            falseCase = b.Validate("({[)]}");

            // Assert
            Assert.IsTrue(trueCase);
            Assert.IsFalse(falseCase);
        }
Ejemplo n.º 2
0
        public void Validate_GivenTheInput_ReturnExpectedResult(string input, bool expectedResult)
        {
            // Act
            var result = sut.Validate(input);

            // Assert
            Assert.Equal(expectedResult, result);
        }
Ejemplo n.º 3
0
        public void Validate_Valid()
        {
            bool result = BracketValidator.Validate("(a + b)[{!c}()]");

            Assert.IsTrue(result);
        }
Ejemplo n.º 4
0
        public void Validate_Mixed()
        {
            bool result = BracketValidator.Validate("()[{(})]");

            Assert.IsFalse(result);
        }
Ejemplo n.º 5
0
        public void Validate_Incomplete()
        {
            bool result = BracketValidator.Validate("((((");

            Assert.IsFalse(result);
        }
Ejemplo n.º 6
0
        public void Validate_Unbalanced()
        {
            bool result = BracketValidator.Validate("()[{()]");

            Assert.IsFalse(result);
        }