public void Should_invoke_static_method_with_no_params_and_no_return_type() { var interceptorWasCalled = false; Intercept.Call += (invocation) => { interceptorWasCalled = true; }; MethodInterceptorTarget.StaticMethodWithNoArgsAndNoReturnType(); Assert.That(interceptorWasCalled); }
public void Should_invoke_static_method_with_some_params_and_no_return_type() { var a = 1; var interceptorWasCalled = false; MethodInterceptorTarget.WhenCalledStatic <MethodInterceptorTarget>( (invocation) => { interceptorWasCalled = true; Assert.That((int)invocation.ParameterValues[0] == 1); }); MethodInterceptorTarget.StaticMethodWithArgsAndNoReturnType(a); Assert.That(interceptorWasCalled); }
public void Should_invoke_static_method_with_value_and_generic_with_no_return_type() { var a = new MethodInterceptorTargetParameter(); var interceptorWasCalled = false; Intercept.Call += (invocation) => { interceptorWasCalled = true; Assert.That((int)invocation.ParameterValues[0] == 1); Assert.That(invocation.ParameterValues[1] == a); }; MethodInterceptorTarget.StaticMethodWithGenericAndValueTypeArgsAndNoReturnType(1, a); Assert.That(interceptorWasCalled); }