public void GetValueTest() { Definition def = new Definition(_mock, 0, 0); def.Add(new Token(TokenType.Name, 0, 0, "Alice")); def.Add(new Token(TokenType.Control, 0, 0, ":")); def.Add(new Token(TokenType.Name, 0, 0, "string")); Assert.AreEqual("", ((MplString)def.GetValue()).Val); }
public void GetTypeTest() { Definition def = new Definition(_mock, 0, 0); def.Add(new Token(TokenType.Name, 0, 0, "Alice")); def.Add(new Token(TokenType.Control, 0, 0, ":")); def.Add(new Token(TokenType.Name, 0, 0, "string")); Assert.AreEqual(Type.String, def.GetType()); }
public void ExitTest() { Definition def = new Definition(_mock, 0, 0); def.Add(new Token(TokenType.Name, 0, 0, "Alice")); def.Add(new Token(TokenType.Control, 0, 0, ":")); def.Add(new Token(TokenType.Name, 0, 0, "bool")); def.Exit(); def.Run(); Assert.IsFalse(((MplBoolean)def.GetValue()).Val); }
private Definition Parse(Definition parent) { Definition def; if (parent == null) { def = this.def; } else { def = new Definition(); } Field temp = null; currentField.Read(InputStream); IStructureOwner struct_owner = (IStructureOwner)def; while (currentField.Type != FieldType.Terminator) { def.Add(temp = FieldUtil.CreateFromDefinitionItem(engine, struct_owner.OwnerObject, currentField)); if (currentField.Type == FieldType.Block || currentField.Type == FieldType.Struct) { Parse(temp.FieldValue as Definition); } currentField.Read(InputStream); } return(def); }
public void RunTest() { Definition def = new Definition(_mock, 0, 0); def.Add(new Token(TokenType.Name, 0, 0, "Nom")); def.Add(new Token(TokenType.Control, 0, 0, ":")); def.Add(new Token(TokenType.Name, 0, 0, "string")); def.Add(new Token(TokenType.Control, 0, 0, ":=")); def.Add(new Token(TokenType.Number, 0, 0, "1")); def.Add(new Token(TokenType.Control, 0, 0, "+")); def.Add(new Token(TokenType.Number, 0, 0, "1")); def.Exit(); def.Run(); Assert.AreEqual(2, ((MplInteger)def.GetValue()).Val); }
public virtual void AddStyle(ChartStyleElementBase styleElement) { Definition.Add(styleElement); }