public void CanValidateNoIntegerArgument() { // Arrange var turtleGraphicsCommand = new TurtleGraphicsCommand { Attribute = new TurtleGraphicsAttribute(), ArgumentAttributes = new List<TurtleGraphicsArgumentAttribute> { new TurtleGraphicsArgumentAttribute {ArgumentType = DataTypes.Integer}, new TurtleGraphicsArgumentAttribute {ArgumentType = DataTypes.Integer} }, ArgumentValues = new List<string>{"1", "NAN"} }; // Act turtleGraphicsCommand.ValidateCommand(); // Assert Assert.AreEqual(turtleGraphicsCommand.Status, TurtleGraphicsCommandStatus.NotAnInteger); Assert.AreEqual(turtleGraphicsCommand.ErrorMessage, ArgumentNotAnInteger); }
public void CanValidateMissingArgument() { // Arrange var turtleGraphicsCommand = new TurtleGraphicsCommand { Attribute = new TurtleGraphicsAttribute(), ArgumentAttributes = new List<TurtleGraphicsArgumentAttribute> { new TurtleGraphicsArgumentAttribute() } }; // Act turtleGraphicsCommand.ValidateCommand(); // Assert Assert.AreEqual(turtleGraphicsCommand.Status, TurtleGraphicsCommandStatus.MissingArguments); Assert.AreEqual(turtleGraphicsCommand.ErrorMessage, ArgumentMissing); }
public void CanValidateMissingAttributes() { // Arrange var turtleGraphicsCommand = new TurtleGraphicsCommand(); // Act turtleGraphicsCommand.ValidateCommand(); // Assert Assert.AreEqual(turtleGraphicsCommand.Status, TurtleGraphicsCommandStatus.InvalidCommand); Assert.AreEqual(turtleGraphicsCommand.ErrorMessage, NotAValidLogoCommand); }
public void CanValidateArgumentPattern() { // Arrange var turtleGraphicsCommand = new TurtleGraphicsCommand { Attribute = new TurtleGraphicsAttribute(), ArgumentAttributes = new List<TurtleGraphicsArgumentAttribute> { new TurtleGraphicsArgumentAttribute { ArgumentType = DataTypes.String, RegEx = GlobalConstants.PatternThatMatchVariable } }, ArgumentValues = new List<string> {InvalidVariablePattern} }; // Act turtleGraphicsCommand.ValidateCommand(); // Assert Assert.AreEqual(turtleGraphicsCommand.Status, TurtleGraphicsCommandStatus.InvalidArgumentPattern); Assert.AreEqual(turtleGraphicsCommand.ErrorMessage, ArgumentInvalidPattern); }