public Task <string> AddRequestAsync(string doc) { var addFunction = new AddFunction(); addFunction.Doc = doc; return(ContractHandler.SendRequestAsync(addFunction)); }
public Task <TransactionReceipt> AddRequestAndWaitForReceiptAsync(string doc, CancellationTokenSource cancellationToken = null) { var addFunction = new AddFunction(); addFunction.Doc = doc; return(ContractHandler.SendRequestAndWaitForReceiptAsync(addFunction, cancellationToken)); }
private static void DelegateExample() { Calculator calc = new Calculator(); AddFunction func = calc.Add; Console.WriteLine(func.Invoke(1, 2)); }
private void editFunctionToolStripMenuItem_Click(object sender, EventArgs e) { AddFunction addFunction = new AddFunction(); addFunction.InitializeFunction = functionList.FunctionList.Current as Function; addFunction.IsEditFunction = true; addFunction.IsValidated = true; addFunction.DataSource = functionList.FunctionList; addFunction.FunctionOK += this.addFunction_FunctionOK; addFunction.ShowDialog(sender as IWin32Window); }
private void addFunctionToolStripMenuItem_Click(object sender, EventArgs e) { AddFunction addFunction = new AddFunction(); addFunction.IsValidated = true; addFunction.DataSource = functionList.FunctionList; addFunction.BackGroundAxisColor = SettingsForm.BackGroundColor; addFunction.FunctionOK += addFunction_FunctionOK; addFunction.ShowDialog(sender as IWin32Window); }
/// <summary> /// Выбор пользователем метода сложения по ключу <see = cref "choice"/> /// </summary> /// <param name="choice">Ключ, по которому выбирается нужная версия функции сложения</param> void ChoseFunc(char choice) { if (keyMapper.ContainsKey(choice)) { Add = keyMapper[choice]; } else { Add = null; } }
public void SuccessfullySetFunctionInfo() { var function = new AddFunction(); Assert.NotNull(function.FunctionInfo); Assert.Equal("Add", function.FunctionInfo.Name); Assert.Equal(new Version("1.0.0"), function.FunctionInfo.Version); Assert.Equal("Add numbers.", function.FunctionInfo.Description); Assert.Collection(function.FunctionInfo.Tags, i => Assert.Equal("algebra", i), i => Assert.Equal("add", i)); }
public void FailToAddASingleNumber() { var function = new AddFunction(); Assert.Throws <ArgumentException>(() => { var inputs = function.GetInputs(); inputs[0].Value = new [] { 1 }; var result = function.Calculate(inputs); }); }
public void Calculator_Works() { //Arrange AddFunction addFunction = new AddFunction(); addFunction.ValueA = 50; addFunction.ValueB = 40; //Act var result = this._sut.Calculate(addFunction); //Assert result.Should().Be(90); }
private static void _test<T>(AddFunction<T> addFunction, Collection<T> toAdd) { UniqueCollection<T> uniqueCollection = new UniqueCollection<T>(); try { addFunction(uniqueCollection, toAdd); } catch (Exception e) { Console.WriteLine(e.Message); } finally { uniqueCollection.Print(); } }
public void TestDelimiterFunction() { ValueFunction function = new AddFunction(); ValueDelimiter delim = new ValueDelimiter(">", DelimiterType.AsArray, function); List<DelimiterNode> nodes = new List<DelimiterNode>(); nodes.Add(ToNode("3")); nodes.Add(ToNode("6")); nodes.Add(ToNode("9")); DelimiterList list = new DelimiterList(delim, nodes, 0, "<", "3 6 9", null); DelimiterNodeList nodelist = new DelimiterNodeList(list); IScope scope = new TestScope(); INodeRequestor values = new TestValueNodeRequestor(nodelist); Value result = EvalNode.Do(nodelist, scope, values, null); Assert.AreEqual(18, result.AsInt); }
public void SuccessfullyAddNumbers() { var function = new AddFunction(); var inputs = function.GetInputs(); Assert.Single(inputs); inputs[0].Value = new [] { 1, 2, 3 }; var result = function.Calculate(inputs); Assert.NotNull(result); Assert.Collection(result, i => { Assert.Equal(typeof(double), i.Value.GetType()); Assert.Equal(6, TypeConverter.ToObject <int>(i.Value)); }); }
public Task <TransactionReceipt> AddRequestAndWaitForReceiptAsync(AddFunction addFunction, CancellationTokenSource cancellationToken = null) { return(ContractHandler.SendRequestAndWaitForReceiptAsync(addFunction, cancellationToken)); }
public Task <string> AddRequestAsync(AddFunction addFunction) { return(ContractHandler.SendRequestAsync(addFunction)); }
public void SetAddFunction(AddFunction addFunc) { this.addFunc = addFunc; }
public override void ToFunction(out Function function) { _left.ToFunction(out var leftF); _right.ToFunction(out var rightF); function = new AddFunction(leftF, rightF); }