Exemplo n.º 1
0
        public async Task SignupControllerPostTestExists()
        {
            var data  = new SignupDataHandler();
            var logic = new CoreApiLogicHandler();

            var signup = SignupData.GetSignup();

            data.Result.Setup(m => m.Execute(It.IsAny <UserByEmail>())).Returns(StandardUser);

            var controller = new SignupController(data, Cloud, logic);
            var result     = await controller.Post(signup) 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);
        }
Exemplo n.º 2
0
        public async Task SignupControllerPostTest()
        {
            var data  = new SignupDataHandler();
            var logic = new CoreApiLogicHandler();

            var signup = SignupData.GetSignup();
            var auth   = LoginData.GetAuth();

            data.Result.Setup(m => m.Execute(It.IsAny <UserByEmail>())).Returns(null);
            logic.Result.Setup(m => m.Execute(It.IsAny <SignupUser>())).Returns(ActionConfirm.CreateSuccess(auth));

            var controller = new SignupController(data, Cloud, logic);
            var result     = await controller.Post(signup) as OkObjectResult;

            result.Should().NotBeNull();
            result.Should().BeOfType <OkObjectResult>();

            logic.HasExecuted.Should().BeTrue();
            logic.Result.Verify(s => s.Execute(It.IsAny <SignupUser>()), Times.Once);

            data.HasExecuted.Should().BeTrue();
            data.HasCommitted.Should().BeFalse();
            data.Result.Verify(s => s.Execute(It.IsAny <UserByEmail>()), Times.Once);
        }