Esempio n. 1
0
        public void Invoke_TooLessArguments_Throws()
        {
            var function = new FunctionCall(typeof(FakeFunctions).GetMethod("Double"));

            var ex = Assert.Throws <InvalidOperationException>(() => function.Invoke());

            Assert.That(ex.Message, Does.Contain("parameter count mismatch"));
        }
Esempio n. 2
0
        public void Invoke_IntPassedDoubleExpected_InvokeSucceeds()
        {
            var function = new FunctionCall(typeof(FakeFunctions).GetMethod("Double"));

            function.AddArgument(21);

            var result = function.Invoke();

            Assert.That(result, Is.EqualTo(42));
        }
Esempio n. 3
0
        public void Invoke_DoublePassedIntExpected_InvokeSucceeds()
        {
            var function = new FunctionCall(typeof(FakeFunctions).GetMethod("Round"));

            function.AddArgument(21.21d);
            function.AddArgument(0d);

            var result = function.Invoke();

            Assert.That(result, Is.EqualTo(21));
        }