Exemplo n.º 1
0
        public void ExecuteVoidValueMethod()
        {
            var executor = GetExecutorForMethod(nameof(TestObject.VoidValueMethod));
            var result   = executor.Execute(
                _targetObject,
                new object[] { 10 });

            Assert2.False(executor.IsMethodAsync);
            Assert2.Null(result);
        }
Exemplo n.º 2
0
        public void ExecuteValueMethod()
        {
            var executor = GetExecutorForMethod(nameof(TestObject.ValueMethod));
            var result   = executor.Execute(
                _targetObject,
                new object[] { 10, 20 });

            Assert2.False(executor.IsMethodAsync);
            Assert2.Equal(30, (int)result);
        }
Exemplo n.º 3
0
        public void ExecuteValueMethodWithReturnTypeThrowsException()
        {
            var executor  = GetExecutorForMethod(nameof(TestObject.ValueMethodWithReturnTypeThrowsException));
            var parameter = new TestObject();

            Assert2.False(executor.IsMethodAsync);
            Assert2.Throws <NotImplementedException>(
                () => executor.Execute(
                    _targetObject,
                    new object[] { parameter }));
        }
Exemplo n.º 4
0
        public void ExecuteValueMethodWithReturnType()
        {
            var executor = GetExecutorForMethod(nameof(TestObject.ValueMethodWithReturnType));
            var result   = executor.Execute(
                _targetObject,
                new object[] { 10 });
            var resultObject = Assert2.IsType <TestObject>(result);

            Assert2.False(executor.IsMethodAsync);
            Assert2.Equal("Hello", resultObject.value);
        }
Exemplo n.º 5
0
        public void ExecuteValueMethodUpdateValue()
        {
            var executor  = GetExecutorForMethod(nameof(TestObject.ValueMethodUpdateValue));
            var parameter = new TestObject();
            var result    = executor.Execute(
                _targetObject,
                new object[] { parameter });
            var resultObject = Assert2.IsType <TestObject>(result);

            Assert2.False(executor.IsMethodAsync);
            Assert2.Equal("HelloWorld", resultObject.value);
        }