Example #1
0
        public void AcceptNegativeTests()
        {
            var ifStatement = new SingleLineIfStatement();

            Assert.IsFalse(ifStatement.Accept("@if (true) Your ID é: @user.id."), "Should not accept without brakets.");
            Assert.IsFalse(ifStatement.Accept("@if (@boolVariable) Your ID é: @user.id."), "Should not accept @ (at) variable reference.");
            Assert.IsFalse(ifStatement.Accept("@if (@obj.BoolProperty) Your ID é: @user.id."), "Should not accept @ (at) variable reference.");
            Assert.IsFalse(ifStatement.Accept("@if (@variable == 0) Your ID é: @user.id."), "Should not accept @ (at) variable reference.");
            Assert.IsFalse(ifStatement.Accept("@if (0 == variable) Your ID é: @user.id."), "Should not accept @ (at) variable reference.");
        }
Example #2
0
        public void AcceptPositiveTests()
        {
            var ifStatement = new SingleLineIfStatement();

            Assert.IsTrue(ifStatement.Accept("@if (true) {}"));
        }