private LocalVariableComponent CreateArithmeticFunctionComponent(Object component, VariableType localVariable) { ArithmeticFunctionType arithmeticFunctionType = (ArithmeticFunctionType)component; ArithmeticFunctionComponent arithmeticFunctionComponent = new ArithmeticFunctionComponent(arithmeticFunctionType); for (int i = 0; i < arithmeticFunctionType.Items.Count(); i++) { LocalVariableComponent variableComponent = this.InstantiateTheCorrectTypeOfComponent(arithmeticFunctionType.Items[i], localVariable); arithmeticFunctionComponent.AddComponent(variableComponent); } return(arithmeticFunctionComponent); }
public void Should_be_possible_to_instantiate_an_ArithmeticFunctionComponent() { var function = new ArithmeticFunctionType() { Items = new object[] { new ObjectComponentType(), new LiteralComponentType() } }; var localVariable = new VariablesTypeVariableLocal_variable() { Item = function }; LocalVariableComponentsFactory factory = new LocalVariableComponentsFactory(null, null); var variableComponent = factory.GetLocalVariableComponent(localVariable); Assert.IsInstanceOfType(variableComponent, typeof(ArithmeticFunctionComponent)); Assert.IsTrue(((ArithmeticFunctionComponent)variableComponent).QuantityOfComponents() == 2, "the quantity of component is not expected"); }
private VariablesTypeVariableLocal_variable GetLocalVariableForAddOperationWithLiteralComponentTypeInt() { LiteralComponentType literalComponent1 = new LiteralComponentType() { Value = 10.ToString(), datatype = SimpleDatatypeEnumeration.@int }; LiteralComponentType literalComponent2 = new LiteralComponentType() { Value = 10.ToString(), datatype = SimpleDatatypeEnumeration.@int }; ArithmeticFunctionType arithmeticFunctionType = new ArithmeticFunctionType() { arithmetic_operation = ArithmeticEnumeration.add, Items = new [] { literalComponent1, literalComponent2 } }; VariablesTypeVariableLocal_variable localVariable = new VariablesTypeVariableLocal_variable() { Item = arithmeticFunctionType }; return(localVariable); }
public OvalArithmeticBuilder(OvalLocalVariableBuilder localVariableBuilder) { this.localVariableBuilder = localVariableBuilder; this.arithmeticFunction = new ArithmeticFunctionType(); this.items = new List <Object>(); }
public ArithmeticFunctionComponent(ArithmeticFunctionType arithmeticFunctionType) { this.arithmeticFunctionType = arithmeticFunctionType; }