public void ActionIsExecuted() { ControllerExecutor executor = new ControllerExecutor(controller, testContext); executor.Execute(executor.SelectAction()); Assert.IsTrue(controller.wasRun, "ControllerExecutor failed to execute the action"); }
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()); }
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); }
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()); }