Пример #1
0
        public void Should_invoke_action_with_parameters_when_invoked()
        {
            //Given
            DynamicDictionary capturedParameters = null;

            Func <dynamic, Response> action = x => {
                capturedParameters = x;
                return(null);
            };

            dynamic parameters = new DynamicDictionary();

            parameters.foo = 10;
            parameters.bar = "value";

            var route = new Route("GET", "/", null, action);

            // When
            route.Invoke(parameters);

            // Then
            capturedParameters.ShouldBeSameAs((object)parameters);
        }
Пример #2
0
        public void Should_invoke_action_with_parameters_when_invoked()
        {
            //Given
            DynamicDictionary capturedParameters = null;

            Func <dynamic, CancellationToken, Task <object> > action = (args, ct) =>
            {
                capturedParameters = args;
                return(Task.FromResult <object>(null));
            };

            dynamic parameters = new DynamicDictionary();

            parameters.foo = 10;
            parameters.bar = "value";

            var route = new Route <object>("GET", "/", null, action);

            // When
            route.Invoke(parameters, new CancellationToken());

            // Then
            capturedParameters.ShouldBeSameAs((object)parameters);
        }