private static UpdateEmailValueController CreateController(ScenarioOptions scenarioOptions = null) { scenarioOptions = scenarioOptions ?? new ScenarioOptions(); scenarioOptions.MockQueryProcessor = new Mock <IProcessQueries>(MockBehavior.Strict); scenarioOptions.MockCommandHandler = new Mock <IHandleCommands <UpdateMyEmailValueCommand> >(MockBehavior.Strict); var services = new UpdateEmailValueServices(scenarioOptions.MockQueryProcessor.Object, scenarioOptions.MockCommandHandler.Object); var controller = new UpdateEmailValueController(services); var builder = ReuseMock.TestControllerBuilder(); builder.HttpContext.User = null; if (!string.IsNullOrWhiteSpace(scenarioOptions.PrincipalIdentityName)) { var principal = scenarioOptions.PrincipalIdentityName.AsPrincipal(); builder.HttpContext.User = principal; } builder.InitializeController(controller); return(controller); }
public UpdateEmailValueController(UpdateEmailValueServices services) { _services = services; }
private static UpdateEmailValueController CreateController(ScenarioOptions scenarioOptions = null) { scenarioOptions = scenarioOptions ?? new ScenarioOptions(); scenarioOptions.MockQueryProcessor = new Mock<IProcessQueries>(MockBehavior.Strict); scenarioOptions.MockCommandHandler = new Mock<IHandleCommands<UpdateMyEmailValueCommand>>(MockBehavior.Strict); var services = new UpdateEmailValueServices(scenarioOptions.MockQueryProcessor.Object, scenarioOptions.MockCommandHandler.Object); var controller = new UpdateEmailValueController(services); var builder = ReuseMock.TestControllerBuilder(); builder.HttpContext.User = null; if (!string.IsNullOrWhiteSpace(scenarioOptions.PrincipalIdentityName)) { var principal = scenarioOptions.PrincipalIdentityName.AsPrincipal(); builder.HttpContext.User = principal; } builder.InitializeController(controller); return controller; }