public async Task ForgotControllerCodeTestTooMany() { var data = new ForgotDataHandler(); var logic = new CoreApiLogicHandler(); data.ResultConfig = new UserConfig() { ForgotCounter = 11 }; var start = ForgotData.GetStart(); data.Result.Setup(m => m.Execute(It.IsAny <UserByEmail>())).Returns(StandardUser); var controller = new ForgotController(data, Cloud, logic); var result = await controller.Code(start) as OkObjectResult; result.Should().NotBeNull(); result.Should().BeOfType <OkObjectResult>(); logic.HasExecuted.Should().BeFalse(); data.HasExecuted.Should().BeTrue(); data.HasCommitted.Should().BeFalse(); data.Result.Verify(s => s.Execute(It.IsAny <UserByEmail>()), Times.Once); }
public async Task ForgotControllerCodeTest() { var data = new ForgotDataHandler(); var logic = new CoreApiLogicHandler(); data.ResultConfig = new UserConfig(); var confirm = ModelConfirm <UserConfig> .CreateSuccess(data.ResultConfig); var start = ForgotData.GetStart(); data.Result.Setup(m => m.Execute(It.IsAny <UserByEmail>())).Returns(StandardUser); data.Result.Setup(m => m.Execute(It.IsAny <Persist <UserConfig> >())).Returns(confirm); logic.Result.Setup(m => m.Execute(It.IsAny <SimpleNotify>())).Returns(ActionConfirm.CreateSuccess("ok")); var controller = new ForgotController(data, Cloud, logic); var result = await controller.Code(start) as OkObjectResult; result.Should().NotBeNull(); result.Should().BeOfType <OkObjectResult>(); logic.HasExecuted.Should().BeTrue(); logic.Result.Verify(s => s.Execute(It.IsAny <SimpleNotify>()), Times.Once); data.HasExecuted.Should().BeTrue(); data.HasCommitted.Should().BeTrue(); data.Result.Verify(s => s.Execute(It.IsAny <UserByEmail>()), Times.Once); }