public void SutIsIMethod()
        {
            var method = new DelegatingMethod();
            var sut    = new MissingParametersSupplyingMethod(method);

            Assert.IsAssignableFrom <IMethod>(sut);
        }
        public void MethodIsCorrect()
        {
            var expectedMethod = new DelegatingMethod();
            var sut = new MissingParametersSupplyingMethod(expectedMethod);

            var result = sut.Method;

            Assert.Equal(expectedMethod, result);
        }
        public void MethodIsCorrect()
        {
            var expectedMethod = new DelegatingMethod();
            var sut            = new MissingParametersSupplyingMethod(expectedMethod);

            var result = sut.Method;

            Assert.Equal(expectedMethod, result);
        }
        public void ParametersIsCorrect()
        {
            Action<int, double> dummy = delegate { };
            var expectedParameters = dummy.Method.GetParameters();
            var method = new DelegatingMethod {OnParameters = () => expectedParameters};
            var sut = new MissingParametersSupplyingMethod(method);

            var result = sut.Parameters;

            Assert.True(expectedParameters.SequenceEqual(result));
        }
        public void InvokeReturnsCorrectResult(Type targetType, string methodName, object[] arguments, object expected)
        {
            var method     = new DelegatingMethod();
            var methodInfo = targetType.GetMethod(methodName);

            method.OnParameters = methodInfo.GetParameters;
            method.OnInvoke     = args => methodInfo.Invoke(null, args.ToArray());
            var sut = new MissingParametersSupplyingMethod(method);

            var result = sut.Invoke(arguments);

            Assert.Equal(expected, result);
        }
        public void ParametersIsCorrect()
        {
            Action <int, double> dummy = delegate { };
            var expectedParameters     = dummy.Method.GetParameters();
            var method = new DelegatingMethod {
                OnParameters = () => expectedParameters
            };
            var sut = new MissingParametersSupplyingMethod(method);

            var result = sut.Parameters;

            Assert.True(expectedParameters.SequenceEqual(result));
        }
        public void InvokeWithCorrectArgumentsReturnsCorrectResult()
        {
            var arguments = new[] {new object(), new object()};
            var expected = new object();
            Action<object, object> dummy = delegate { };
            var method = new DelegatingMethod();
            method.OnParameters = () => dummy.Method.GetParameters();
            method.OnInvoke = args => arguments.SequenceEqual(args) ? expected : null;
            var sut = new MissingParametersSupplyingMethod(method);

            var result = sut.Invoke(arguments);

            Assert.Equal(expected, result);
        }
        public void InvokeWithCorrectArgumentsReturnsCorrectResult()
        {
            var arguments = new[] { new object(), new object() };
            var expected  = new object();
            Action <object, object> dummy = delegate { };
            var method = new DelegatingMethod();

            method.OnParameters = () => dummy.Method.GetParameters();
            method.OnInvoke     = args => arguments.SequenceEqual(args) ? expected : null;
            var sut = new MissingParametersSupplyingMethod(method);

            var result = sut.Invoke(arguments);

            Assert.Equal(expected, result);
        }
        public void InvokeReturnsCorrectResult(Type targetType, string methodName, object[] arguments, object expected)
        {
            var method = new DelegatingMethod();
            var methodInfo = targetType.GetMethod(methodName);
            method.OnParameters = methodInfo.GetParameters;
            method.OnInvoke = args => methodInfo.Invoke(null, args.ToArray());
            var sut = new MissingParametersSupplyingMethod(method);

            var result = sut.Invoke(arguments);

            Assert.Equal(expected, result);
        }
 public void SutIsIMethod()
 {
     var method = new DelegatingMethod();
     var sut = new MissingParametersSupplyingMethod(method);
     Assert.IsAssignableFrom<IMethod>(sut);
 }