public async void Task_DeleteAccount_OkResult() { //Arrange var controller = new ComptesAPIController(repository); //Act string username = RandomString(7); var account = new RegisterAccountViewModel() { Name = "Test name", Username = username, Email = "*****@*****.**", Password = "******", RepeatPassword = "******" }; var existingAccount = await controller.AddAccount(account); var okResult = existingAccount.Should().BeOfType <OkObjectResult>().Subject; var result = okResult.Value.Should().BeAssignableTo <Account>().Subject; var data = await controller.Delete(result.Id); //Assert Assert.IsType <OkObjectResult>(data); }
public async void Task_AddAccount_Password_NotMatch_BadRequestResult() { //Arrange var controller = new ComptesAPIController(repository); var account = new RegisterAccountViewModel() { Name = "Test name", Username = "******", Email = "*****@*****.**", Password = "******", RepeatPassword = "******" }; //Act var data = await controller.AddAccount(account); //Assert Assert.IsType <BadRequestResult>(data); }
public async void Task_AddAccount_UsernameExist_BadRequestResult() { //Arrange var controller = new ComptesAPIController(repository); string username = RandomString(7); var account = new RegisterAccountViewModel() { Name = "Test name", Username = "******", Email = "*****@*****.**", Password = "******", RepeatPassword = "******" }; //Act var data = await controller.AddAccount(account); //Assert Assert.IsType <BadRequestObjectResult>(data); }