public void Execute_IntegrationTest_SQLite()
        {
            string filePath = Path.Combine(AppContext.BaseDirectory, Path.GetRandomFileName() + ".dbtest");

            using (SQLiteDbContext dbContext = new SQLiteDbContext(filePath))
            {
                dbContext.Initialise();
                dbContext.BeginTransaction();

                // create the user
                UserModel user = DataHelper.CreateUserModel();

                IUserRepository   userRepo         = new UserRepository(dbContext);
                IUserValidator    userValidator    = new UserValidator(userRepo);
                IPasswordProvider passwordProvider = new PasswordProvider();

                ICreateUserCommand createUserCommand = new CreateUserCommand(dbContext, userValidator, passwordProvider);
                createUserCommand.Execute(user.UserName, user.Password, user.Role);

                UserModel savedUser = userRepo.GetByUserName(user.UserName);

                Assert.IsNotNull(savedUser);
                Assert.AreEqual(user.Role, savedUser.Role);
                Assert.IsTrue(passwordProvider.CheckPassword(user.Password, savedUser.Password));
            }
        }
        public void Execute_IntegrationTest_SQLite()
        {
            string filePath = Path.Combine(AppContext.BaseDirectory, Path.GetRandomFileName() + ".dbtest");

            using (SQLiteDbContext dbContext = new SQLiteDbContext(filePath))
            {
                dbContext.Initialise();
                dbContext.BeginTransaction();

                // create the user
                UserModel       user          = DataHelper.CreateUserModel();
                IUserRepository userRepo      = new UserRepository(dbContext);
                IUserValidator  userValidator = new UserValidator(userRepo);

                IPasswordProvider  passwordProvider  = new PasswordProvider();
                ICreateUserCommand createUserCommand = new CreateUserCommand(dbContext, userValidator, passwordProvider);
                UserModel          savedUser         = createUserCommand.Execute(user.UserName, user.Password, user.Role);

                // reset the password
                string newPassword = Guid.NewGuid().ToString();
                IUpdateUserPasswordCommand updateCommand = new UpdateUserPasswordCommand(dbContext, userRepo, passwordProvider);
                updateCommand.Execute(savedUser.UserName, newPassword);

                // now fetch it again and check the password is good
                savedUser = userRepo.GetByUserName(user.UserName);
                Assert.IsTrue(passwordProvider.CheckPassword(newPassword, savedUser.Password));
            }
        }