public void AddValueDecoratorTest() { double _a = 15; double _b = 5; Func <double, double, double> _action = Operations.Division; Calculator _calculator = new Calculator(new CalculatorBuilder()); var _result = _calculator.CreateCalculation(_a, _b, _action); Func <List <double>, double> _operations = OperationList.SumList; AddValues _addValues = new AddValues(_result.GetResult()); List <double> _newValues = new List <double> { 1, 2, 3, 4, 5, 6 }; var _newResults = _addValues.CreateNewCalculation(_newValues, _operations); Assert.AreEqual(_result.GetResult(), 3); Assert.AreEqual(_newResults.GetResult(), 24); Console.WriteLine(_newResults.GetResult()); }
public int DoAddValues(AddValues addValues) { return(addValues.Value1 + addValues.Value2); }
public void Setup() { addValueInst = new AddValues(2); }
public void Destroy() { addValueInst = null; }
public void InitializeTools(ININ.Interop.IDTypeLib.II3ID Designer) { var IntegerTypeSpecifier = "::" + Designer.QueryNativeTypeName(ININ.Interop.IDTypeLib.I3IDNativeDataType.ID_INTEGER); var StringTypeSpecifier = "::" + Designer.QueryNativeTypeName(ININ.Interop.IDTypeLib.I3IDNativeDataType.ID_STRING); ININ.Interop.IDTypeLib.II3IDTool AddValues; AddValues = Designer.Tools.RegisterTool( null, //event sink - it gets called when it is created? see API guide "TSD - Add Values", //Label "ToolStepDemo", //ToolModuleName "TSD_Add", //Toolname - this should probably be unique "Implements adding a string to an integer", //Description "Tool Step Demo", //Tool Category "ToolStepDemo", //DLL Name "AddValues", //Function name (in above DLL) 3 //number of parameters ); AddValues.ParameterDefinitions.Item(0).SetAsInputComboBox(IntegerTypeSpecifier, "Operand 1", true); AddValues.ParameterDefinitions.Item(1).SetAsInputComboBox(StringTypeSpecifier, "Operand 2", true); AddValues.ParameterDefinitions.Item(2).SetAsOutput(IntegerTypeSpecifier, "Result", true); AddValues.ExitPaths.Add("Success", 3, false); AddValues.ExitPaths.Add("Convert Error", 1, true); AddValues.ExitPaths.Add("Failure", 2, true); AddValues.Commit(); ININ.Interop.IDTypeLib.II3IDTool UpdateLog; UpdateLog = Designer.Tools.RegisterTool( null, //event sink - it gets called when it is created? see API guide "TSD - Update Log", //Label "ToolStepDemo", //ToolModuleName "TSD_UpdateLog", //Toolname - this should probably be unique "Implements adding a log message with date/timestamp", //Description "Tool Step Demo", //Tool Category "ToolStepDemo", //DLL Name "updateLog", //Function name (in above DLL) 2 //number of parameters ); UpdateLog.ParameterDefinitions.Item(0).SetAsOutput(StringTypeSpecifier, "Log", true); UpdateLog.ParameterDefinitions.Item(1).SetAsInputComboBox(StringTypeSpecifier, "Message", true); UpdateLog.ExitPaths.Add("Next", 1, false); UpdateLog.Commit(); ININ.Interop.IDTypeLib.II3IDTool StockQuote; StockQuote = Designer.Tools.RegisterTool( null, //event sink - it gets called when it is created? see API guide "TSD - Stock Quote", //Label "ToolStepDemo", //ToolModuleName "TSD_StockQuote", //Toolname - this should probably be unique "Implements getting a stock quote via a web service", //Description "Tool Step Demo", //Tool Category "ToolStepDemo", //DLL Name "getStockQuote", //Function name (in above DLL) 2 //number of parameters ); StockQuote.ParameterDefinitions.Item(0).SetAsInputComboBox(StringTypeSpecifier, "Stock Symbol", true); StockQuote.ParameterDefinitions.Item(1).SetAsOutput(StringTypeSpecifier, "Stock Quote", true); StockQuote.ExitPaths.Add("Next", 1, false); StockQuote.Commit(); }