public void WhenParsingSimpleAdd_ThenShouldGetThreeTokens() { // Arrange var parser = new EquationParser(); // Act var result = parser.Parse("1+2"); // Assert Assert.AreEqual(3, result.Tokens.Count); }
public void WhenParsingSimpleAdd_ThenSecondTokenShouldBeAnAddOperator() { // Arrange var parser = new EquationParser(); // Act var result = parser.Parse("1+2"); // Assert Assert.AreEqual(TokenType.Operator, result.Tokens[1].Type); }
public void WhenParsingNull_ThenShouldReturnZeroTokens() { // Arrange var parser = new EquationParser(); // Act var result = parser.Parse(null); // Assert Assert.AreEqual(0, result.Tokens.Count); }
public void WhenParsingSimpleAdd_ThenFirstTokenShouldBeAValueOf1() { // Arrange var parser = new EquationParser(); // Act var result = parser.Parse("1+2"); // Assert Assert.AreEqual(TokenType.Value, result.Tokens[0].Type); Assert.AreEqual(1m, result.Tokens[0].Value); }