public Task <BigInteger> MultiplyQueryAsync(BigInteger a, BlockParameter blockParameter = null)
        {
            var multiplyFunction = new MultiplyFunction();

            multiplyFunction.A = a;

            return(ContractHandler.QueryAsync <MultiplyFunction, BigInteger>(multiplyFunction, blockParameter));
        }
Ejemplo n.º 2
0
        public void SuccessfullySetFunctionInfo()
        {
            var function = new MultiplyFunction();

            Assert.NotNull(function.FunctionInfo);
            Assert.Equal("Multiply", function.FunctionInfo.Name);
            Assert.Equal(new Version("1.0.0"), function.FunctionInfo.Version);
            Assert.Equal("Multiply numbers.", function.FunctionInfo.Description);
            Assert.Collection(function.FunctionInfo.Tags,
                              i => Assert.Equal("algebra", i),
                              i => Assert.Equal("multiply", i));
        }
        public void FailToMultiplyASingleNumber()
        {
            var function = new MultiplyFunction();

            Assert.Throws <ArgumentException>(() =>
            {
                var inputs = function.GetInputs();

                inputs[0].Value = new[] { 1 };

                var result = function.Calculate(inputs);
            });
        }
        public void SuccessfullyMultiplyNumbers()
        {
            var function = new MultiplyFunction();

            var inputs = function.GetInputs();

            Assert.Single(inputs);

            inputs[0].Value = new[] { 100, 2, 3 };

            var result = function.Calculate(inputs);

            Assert.NotNull(result);
            Assert.Collection(result,
                              i =>
            {
                Assert.Equal(typeof(double), i.Value.GetType());
                Assert.Equal(600, TypeConverter.ToObject <int>(i.Value));
            });
        }
 public Task <BigInteger> MultiplyQueryAsync(MultiplyFunction multiplyFunction, BlockParameter blockParameter = null)
 {
     return(ContractHandler.QueryAsync <MultiplyFunction, BigInteger>(multiplyFunction, blockParameter));
 }