public void CadastrarUsuarioValido() { // Arrange var controller = new AutenticacaoController(); var novoUsuario = new UserCreateDTO { Username = "******", Password = "******" }; // Act var response = controller.CreateUser(novoUsuario) as OkResult; var expected = (int)HttpStatusCode.OK; // Assert Assert.NotNull(response); Assert.Equal(expected, response.StatusCode); }
public void CadastrarUsuarioInvalido() { // Arrange var controller = new AutenticacaoController(); Startup.createdUsers.Add(new User { Username = "******", Password = "******" }); var novoUsuario = new UserCreateDTO { Username = "******", Password = "" }; // Act var response = controller.CreateUser(novoUsuario) as BadRequestResult; var expected = (int)HttpStatusCode.BadRequest; // Assert Assert.NotNull(response); Assert.Equal(expected, response.StatusCode); }