Exemplo n.º 1
0
        public async Task UserCanLogin()
        {
            var nameDb = Guid.NewGuid().ToString();
            var accountsControllerHelper = new AccountsControllerHelpers();
            await accountsControllerHelper.CreateUserHelper(nameDb);

            var controller = accountsControllerHelper.BuildAccountsController(nameDb);
            var user       = new User()
            {
                Email = "*****@*****.**", Password = "******"
            };
            var response = await controller.Login(user);

            Assert.IsNotNull(response.Value);
            Assert.IsNotNull(response.Value.Token);
        }
Exemplo n.º 2
0
        public async Task UserCannotLogin()
        {
            var nameDb = Guid.NewGuid().ToString();
            var accountsControllerHelper = new AccountsControllerHelpers();
            await accountsControllerHelper.CreateUserHelper(nameDb);

            var controller = accountsControllerHelper.BuildAccountsController(nameDb);
            var user       = new User()
            {
                Email = "*****@*****.**", Password = "******"
            };
            var response = await controller.Login(user);

            Assert.IsNull(response.Value);
            var result = response.Result as BadRequestObjectResult;

            Assert.IsNotNull(result);
        }