Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public async void Task_DeleteAccount_BadRequestResult()
        {
            //Arrange
            var controller = new ComptesAPIController(repository);


            //Act
            var data = await controller.Delete(17500);

            //Assert
            Assert.IsType <BadRequestObjectResult>(data);
        }