コード例 #1
0
		public void ActionIsExecuted()
		{
			ControllerExecutor executor = new ControllerExecutor(controller, testContext);

			executor.Execute(executor.SelectAction());

			Assert.IsTrue(controller.wasRun, "ControllerExecutor failed to execute the action");
		}
コード例 #2
0
        public async Task Process_StandardControllerNoResponse_CreatedDefaultReturned()
        {
            // Assign
            _controllerFactory.Setup(
                x =>
                x.CreateController(It.IsAny <Type>(), It.IsAny <IDIContainerProvider>(), It.IsAny <HttpContext>(),
                                   It.IsAny <IDictionary <string, object> >())).Returns(_syncController.Object);
            // Act
            var result = await _executor.Execute(Mock.Of <IControllerMetaData>(), null !, null !);

            // Assert

            Assert.AreEqual(ControllerResponseResult.Default, result);
            _controllerFactory.Verify(
                x =>
                x.CreateController(It.IsAny <Type>(), It.IsAny <IDIContainerProvider>(), It.IsAny <HttpContext>(),
                                   It.IsAny <IDictionary <string, object> >()));
            _syncController.Verify(x => x.Invoke());
        }
コード例 #3
0
		public void ActionIsSelectedAndRun()
		{
			ControllerExecutor executor = new ControllerExecutor(controller, testContext);

			ActionExecutor actionExec = executor.SelectAction();

			Assert.IsNotNull(actionExec);
			Assert.AreEqual(ActionType.Method, actionExec.ActionType);
			Assert.AreEqual("Index", actionExec.Name);

			executor.Execute(actionExec);

			Assert.IsTrue(controller.wasRun);
		}
コード例 #4
0
        public void Process_StandardControllerNoResponse_CreatedDefaultReturned()
        {
            // Assign
            _controllerFactory.Setup(
                x =>
                x.CreateController(It.IsAny <Type>(), It.IsAny <IDIContainerProvider>(), It.IsAny <IOwinContext>(),
                                   It.IsAny <IDictionary <string, Object> >())).Returns(_syncController.Object);
            // Act
            var result = _executor.Execute(null, null, null);

            // Assert

            Assert.AreEqual(ControllerResponseResult.Default, result);
            _controllerFactory.Verify(
                x =>
                x.CreateController(It.IsAny <Type>(), It.IsAny <IDIContainerProvider>(), It.IsAny <IOwinContext>(),
                                   It.IsAny <IDictionary <string, Object> >()));
            _syncController.Verify(x => x.Invoke());
        }