public void ExecuteMethodProperlyWithGivenParameterTypes() { var obj = new TestMethodClass(); var wrapper = new ImplBaseTester(obj); wrapper.ExecuteMethod2(nameof(obj.Method), new[] { typeof(int) }, 42); Assert.IsTrue(obj.CorrectMethodExecuted); }
public void ExecuteMethodProperly() { var obj = new TestMethodClass(); var wrapper = new ImplBaseTester(obj); wrapper.ExecuteMethod(nameof(obj.Method), 42); Assert.IsTrue(obj.CorrectMethodExecuted); }
public void ThrowExceptionIfParametersIsNull() { var obj = new TestMethodClass(); var wrapper = new ImplBaseTester(obj); var ex = Assert.Throws <ArgumentNullException>(() => wrapper.ExecuteMethod(nameof(obj.Method), null)); Assert.IsNotNull(ex); ex.ParamName.Should().Be("parameters"); }
public void ThrowExceptionIfMethodNameIsInvalid() { var obj = new TestMethodClass(); var wrapper = new ImplBaseTester(obj); var ex = Assert.Throws <ArgumentOutOfRangeException>(() => wrapper.ExecuteMethod("invalid", 42)); Assert.IsNotNull(ex); ex.Message.Should().Be($"Class method with given name does not exist!{Environment.NewLine}Parameter name: methodName"); }