Exemplo n.º 1
0
        public void CallRoute_Throws_If_Environment_Is_Null()
        {
            var route           = Route_Tests.CreateRoute <Controller>(nameof(Controller.Route_1));
            var routeParameters = Route_Tests.CreateRouteParameters(41);

            _RouteCaller.CallRoute(null, route, routeParameters);
        }
Exemplo n.º 2
0
        public void CallRoute_Disposes_Of_Disposable_Controllers()
        {
            var route           = Route_Tests.CreateRoute <DisposableController>(nameof(DisposableController.Route_D1));
            var routeParameters = Route_Tests.CreateRouteParameters(99);

            _RouteCaller.CallRoute(_Environment.Environment, route, routeParameters);

            Assert.IsTrue(_DisposableControllerDisposed);
        }
Exemplo n.º 3
0
        public void CallRoute_Can_Call_Void_Routes()
        {
            var route           = Route_Tests.CreateRoute <Controller>(nameof(Controller.Route_3));
            var routeParameters = Route_Tests.CreateRouteParameters(41);

            var outcome = _RouteCaller.CallRoute(_Environment.Environment, route, routeParameters);

            Assert.IsNull(outcome);
            Assert.IsNotNull(_ControllerInstance);
            Assert.AreEqual(1, _ControllerInstance.Route_3_CallCount);
            Assert.AreEqual(41, _ControllerInstance.Route_3_LastInput);
        }
Exemplo n.º 4
0
        public void CallRoute_Can_Call_Static_Routes()
        {
            var route           = Route_Tests.CreateRoute <Controller>(nameof(Controller.Route_2));
            var routeParameters = Route_Tests.CreateRouteParameters(_Environment.Environment, 32);

            var outcome = _RouteCaller.CallRoute(_Environment.Environment, route, routeParameters);

            Assert.IsNull(_ControllerInstance);
            Assert.AreEqual(1, Controller.Route_2_CallCount);
            Assert.AreEqual(32, Controller.Route_2_LastInput);
            Assert.AreEqual(64, outcome);
        }
Exemplo n.º 5
0
        public void CallRoute_Creates_Instance_Of_Controller_And_Calls_Route()
        {
            var route           = Route_Tests.CreateRoute <Controller>(nameof(Controller.Route_1));
            var routeParameters = Route_Tests.CreateRouteParameters(41);

            var outcome = _RouteCaller.CallRoute(_Environment.Environment, route, routeParameters);

            Assert.IsNotNull(_ControllerInstance);
            Assert.AreEqual(1, _ControllerInstance.Route_1_CallCount);
            Assert.AreEqual(41, _ControllerInstance.Route_1_LastInput);
            Assert.AreEqual(42, outcome);
        }
Exemplo n.º 6
0
        public void CallRoute_Disposes_Of_Disposable_Controllers_Even_When_Exception_Is_Thrown()
        {
            var route           = Route_Tests.CreateRoute <DisposableController>(nameof(DisposableController.Route_ExceptionThrower));
            var routeParameters = Route_Tests.CreateRouteParameters(0);

            bool exceptionThrown = false;

            try {
                _RouteCaller.CallRoute(_Environment.Environment, route, routeParameters);
            } catch {
                exceptionThrown = true;
            }

            Assert.IsTrue(_DisposableControllerDisposed);
            Assert.IsTrue(exceptionThrown);
        }
Exemplo n.º 7
0
        public void CallRoute_Throws_If_Route_Is_Null()
        {
            var routeParameters = Route_Tests.CreateRouteParameters(41);

            _RouteCaller.CallRoute(_Environment.Environment, null, routeParameters);
        }