public void ParameteredConstructor_Assigns_Properties()
        {
            //Arrange
            var username = fixture.Create <string>();
            var password = fixture.Create <string>();

            //Act
            var command = new AuthenticateWithCredentialsCommand(username, password);

            //Assert
            command.UserName.Should().Be(username);
            command.Password.Should().Be(password);
        }
Example #2
0
        public async Task <ActionResult> Authenticate([FromBody] AuthenticateWithCredentialsCommand command)
        {
            ActionResult result;

            try
            {
                await mediator.Send(command);

                result = Ok();
            }
            catch (InvalidCredentialException)
            {
                result = BadRequest();
            }
            catch (Exception)
            {
                result = new StatusCodeResult(StatusCodes.Status500InternalServerError);
            }

            return(result);
        }