Exemplo n.º 1
0
        public async Task LoginUser_ShouldRRefreshUserToken(CommandResult <UserLoginResponse> commandResultExpected)
        {
            //Arrange
            _mediatorHandler.Setup(s => s.SendCommand <TokenRefreshCommand, UserLoginResponse>(It.IsAny <TokenRefreshCommand>())).ReturnsAsync(commandResultExpected);

            _sut = new AuthController(_mediatorHandler.Object);

            var refreshToken = Guid.NewGuid().ToString();

            //Act
            var response = await _sut.RefreshToken(refreshToken);

            var result = new CommandResultObjectMap <UserLoginResponse>(response);

            //Assert
            result.ErrorCode.Should().Be(200);
            result.CommandResult.Should().NotBeNull();
            result.CommandResult.Should().BeEquivalentTo(commandResultExpected.Payload);
        }
Exemplo n.º 2
0
        public async Task LoginUser_ShouldLogingTheUser(CommandResult <UserLoginResponse> commandResultExpected)
        {
            //Arrange
            var request = new UserLoginView();

            request.Email    = "*****@*****.**";
            request.Password = "******";

            _mediatorHandler.Setup(s => s.SendCommand <UserLoginCommand, UserLoginResponse>(It.IsAny <UserLoginCommand>())).ReturnsAsync(commandResultExpected);

            _sut = new AuthController(_mediatorHandler.Object);

            //Act
            var response = await _sut.Login(request);

            var result = new CommandResultObjectMap <UserLoginResponse>(response);

            //Assert
            result.ErrorCode.Should().Be(200);
            result.CommandResult.Should().NotBeNull();
            result.CommandResult.Should().BeEquivalentTo(commandResultExpected.Payload);
        }