public void NoArguments()
        {
            var obj    = new TestObject();
            var result = Invoke.InstanceMethod(obj, "TestA");

            result.Value.Should().Be("A");
        }
        public void NoArgsDefaultParameterValue()
        {
            // Arguments of the same type should have their relative ordering preserved when the
            // method has multiple arguments of that type
            var obj    = new TestObject();
            var result = Invoke.InstanceMethod(obj, "TestC");

            result.Value.Should().Be("C,0");
        }
        public void OrderedArguments()
        {
            // Arguments of the same type should have their relative ordering preserved when the
            // method has multiple arguments of that type
            var obj    = new TestObject();
            var result = Invoke.InstanceMethod(obj, "TestB", 1, 2);

            result.Value.Should().Be("B,1,2");
        }
        public void ThrowOnError()
        {
            var    obj = new TestObject();
            Action act = () => Invoke.InstanceMethod(obj, "TestA").ThrowOnError();

            act.Should().NotThrow();

            act = () => Invoke.InstanceMethod(obj, "TestB").ThrowOnError();
            act.Should().Throw <InvokeException>();
        }
        public void NoMatch()
        {
            // TestA has a parameterless overload, so that will be invoked
            var obj    = new TestObject();
            var result = Invoke.InstanceMethod(obj, "TestA", "ok");

            result.Value.Should().Be("A");

            // TestB has no parameterless overload, so there is no match
            result = Invoke.InstanceMethod(obj, "TestB", "ok");
            result.Success.Should().BeFalse();
        }