Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public void ExecuteMethodProperly()
        {
            var obj     = new TestMethodClass();
            var wrapper = new ImplBaseTester(obj);

            wrapper.ExecuteMethod(nameof(obj.Method), 42);
            Assert.IsTrue(obj.CorrectMethodExecuted);
        }
Exemplo n.º 3
0
        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");
        }
Exemplo n.º 4
0
        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");
        }