public void ExecuteSimple() { var field = new FieldSyntax { Name = new NameSyntax { Value = "key" }, Value = new ListSyntax { new TextSyntax { Text = "value" } } }; var objectField = fieldInstruction.Evaluate(CompilerStateFixtures.Empty(), field); Assert.IsType <ObjectField>(objectField); var castedField = (ObjectField)objectField; Assert.Equal("key", castedField.Key); var resultArguments = (Argument[])castedField.Argument.Value; var paragraph = (Paragraph)resultArguments[0].Value; var leaf = (ITextLeaf)paragraph.Leaves[0]; Assert.Equal("value", leaf.Content); }
public void ExecuteNullSyntaxNodeException() { var ex = Assert.Throws <ArgumentNullException>(() => { textInstruction.Evaluate(CompilerStateFixtures.Empty(), null); }); Assert.Equal("text", ex.ParamName); }
public void EvaluateFieldNullException() { var ex = Assert.Throws <ArgumentNullException>(() => { fieldInstruction.Evaluate(CompilerStateFixtures.Empty(), null); }); Assert.Equal("field", ex.ParamName); }
public void NullElementConstructionException() { var ex = Assert.Throws <ArgumentNullException>(() => { new ObjectCreator(null, CompilerStateFixtures.ReflectionLoaded()); }); Assert.Equal("origin", ex.ParamName); }
public void NonValidTypeException() { var ex = Assert.Throws <ArgumentNullException>(() => { EngineInstruction.Evaluate(CompilerStateFixtures.Empty(), null); }); Assert.Equal("node", ex.ParamName); }
public void EvaluateEmpty() { var node = new ArraySyntax(); var result = arrayInstruction.Evaluate(CompilerStateFixtures.Empty(), node); Assert.IsType <ObjectArray>(result); var array = (ObjectArray)result; Assert.Equal(node, array.Origin); Assert.Empty(array.Get(typeof(object))); }
public void ReturnsValueTest() { var cs = CompilerStateFixtures.Empty(); PageVariables.Size.Set(cs.Document, new Size(410, 0)); PageVariables.Margin.Set(cs.Document, Thickness.Zero); var result = instruction.Evaluate(cs, new Language.Syntax.PercentSyntax()); Assert.IsType <string>(result); Assert.Equal("*4.1pt", result as string); }
public void ExecuteSimple() { var result = textInstruction.Evaluate(CompilerStateFixtures.Empty(), new TextSyntax { Text = "text" }); Assert.IsType <TextLeaf>(result); var text = (TextLeaf)result; Assert.Equal("text", text.Content); }