/// <summary> /// Scans the statement and returns a list of tokens /// </summary> /// <param name="statement"></param> /// <returns></returns> public IEnumerable<AToken> GetTokens(string statement) { var tokens = statement.Split(' '); var factory = new TokenFactory(); foreach (var token in tokens) { yield return factory.Interpret(token); } }
public void MultiplicationIsRecognized() { TokenFactory factory = new TokenFactory(); var token = factory.Interpret("*"); Assert.AreEqual(token.GetType(), typeof (Multiplication)); }