public void ExecuteIfCommandWithFalseCondition() { IfCommand ifcmd = new IfCommand(new ConstantExpression(false), new SetCommand("one", new ConstantExpression(1))); Machine machine = new Machine(); ifcmd.Execute(machine.Environment); Assert.IsNull(machine.Environment.GetValue("one")); }
public void ExecuteIfCommandWithTrueCondition() { IfCommand ifcmd = new IfCommand(new ConstantExpression(true), new SetCommand("one", new ConstantExpression(1))); Machine machine = new Machine(); ifcmd.Execute(machine.Environment); Assert.IsNotNull(ifcmd.ThenCommand); Assert.IsNull(ifcmd.ElseCommand); Assert.AreEqual(1, machine.Environment.GetValue("one")); }