Exemplo n.º 1
0
        public async Task Overload_T_string_string()
        {
            var invoker = new GenericMethodInvoker(typeof(IDummyGrain), "Method", 1);
            var mock    = new FooGrain();

            var result = await invoker.Invoke(mock, new object[]
            {
                typeof(bool),
                typeof(bool), typeof(string), typeof(string),
                false, "bar", "foo"
            });

            Assert.Equal(4, result);
        }
Exemplo n.º 2
0
        public async Task Overload_Int_String_T()
        {
            var invoker = new GenericMethodInvoker(typeof(IDummyGrain), "Method", 1);
            var mock    = new FooGrain();

            var result = await invoker.Invoke(mock, new object[]
            {
                typeof(bool),
                typeof(int), typeof(string), typeof(bool),
                42, "bar", true
            });

            Assert.Equal(3, result);
        }
Exemplo n.º 3
0
        public async Task Overload_invoke_with_null()
        {
            var invoker = new GenericMethodInvoker(typeof(IDummyGrain), "Method", 2);
            var mock    = new FooGrain();

            var result = await invoker.Invoke(mock, new object[]
            {
                typeof(string[]), typeof(double),
                typeof(string[]), typeof(double),
                null, 0.5d
            });

            Assert.Equal(6, result);
        }
Exemplo n.º 4
0
        public async Task Overload_multiple_type_parameters()
        {
            var invoker = new GenericMethodInvoker(typeof(IDummyGrain), "Method", 2);
            var mock    = new FooGrain();

            var result = await invoker.Invoke(mock, new object[]
            {
                typeof(string[]), typeof(double),
                typeof(string[]), typeof(double),
                new [] { "a", "b", "c" }, 0.5d
            });

            Assert.Equal(6, result);
        }
Exemplo n.º 5
0
        public async Task Overload_object_array_covariant_arg()
        {
            var invoker = new GenericMethodInvoker(typeof(IDummyGrain), "Method", 1);
            var mock    = new FooGrain();

            var result = await invoker.Invoke(mock, new object[]
            {
                typeof(bool),
                typeof(string[]),
                new [] { "a", "b", "c" }
            });

            Assert.Equal(5, result);
        }
Exemplo n.º 6
0
        public async Task Overload_Int()
        {
            var invoker = new GenericMethodInvoker(typeof(IDummyGrain), "Method", 1);

            var mock = new FooGrain();

            // callsite: mock.Method<bool>(42);
            var result = await invoker.Invoke(mock, new object[]
            {
                typeof(bool),   // type parameter(s)
                typeof(int),    // argument type(s)
                42              // argument(s)
            });

            Assert.Equal(1, result);
        }