Esempio n. 1
0
        public void AddTodo_NormalName_True()
        {
            var options = new DbContextOptionsBuilder <Mystivate_dbContext>()
                          .UseInMemoryDatabase(databaseName: "AddTodo_NormalName_True")
                          .Options;

            using (var context = new Mystivate_dbContext(options))
            {
                IAccountAccess accountAccess = new AccountAccess(context);
                string         email         = "*****@*****.**";
                UserTestsMethods.RegisterUser(accountAccess, "test", email, "test123");
                int taskId = AddTodo(new TaskAccess(context), UserTestsMethods.GetUserId(accountAccess, email), "Normal task");
                Assert.IsTrue(ToDoExists(context, taskId));
            }
        }
Esempio n. 2
0
        public void RegisterUser_TwoSameUsernameEmail_False()
        {
            var options = new DbContextOptionsBuilder <Mystivate_dbContext>()
                          .UseInMemoryDatabase(databaseName: "RegisterUser_TwoSameUsernameEmail_False")
                          .Options;

            using (var context = new Mystivate_dbContext(options))
            {
                IAccountAccess accountAccess = new AccountAccess(context);
                string         username      = "******";
                string         email         = "*****@*****.**";
                string         password      = "******";

                Assert.IsTrue(UserTestsMethods.RegisterUser(accountAccess, username, email, password));

                Assert.IsFalse(UserTestsMethods.RegisterUser(accountAccess, username, email, password));
            }
        }
Esempio n. 3
0
        public void LoginUser_CorrectCredentials_True()
        {
            var options = new DbContextOptionsBuilder <Mystivate_dbContext>()
                          .UseInMemoryDatabase(databaseName: "LoginUser_CorrectCredentials_True")
                          .Options;

            using (var context = new Mystivate_dbContext(options))
            {
                IAccountAccess accountAccess = new AccountAccess(context);

                string username = "******";
                string email    = "*****@*****.**";
                string password = "******";
                Assert.IsTrue(UserTestsMethods.RegisterUser(accountAccess, username, email, password));

                EncryptedPassword encryptedPasswordDB = UserTestsMethods.GetPassword(accountAccess, email);

                Assert.IsTrue(PasswordEncryptor.PasswordCorrect(password, encryptedPasswordDB));
            }
        }