Esempio n. 1
0
        public void ValidateCorrectPassword()
        {
            var author = new Author("joe", "test1234");
            var passwordHash = author.PasswordHash;

            Assert.IsTrue(author.ValidatePassword("test1234"), "Author.ValidatePassword() does not pass a correct password.");
        }
Esempio n. 2
0
        public void ValidateIncorrectPassword()
        {
            var author = new Author("joe", "test1234");
            var passwordHash = author.PasswordHash;

            Assert.IsFalse(author.ValidatePassword("test4567"), "Author.ValidatePassword() does not fail an incorrect password");
        }
Esempio n. 3
0
        public void CreateAuthor()
        {
            var author = new Author("joe", "test1234");
            author.DisplayName = "Joe Bloggs";
            author.Save();

            var saved = Author.FindById(author.AuthorId);

            Assert.IsNotNull(saved, "Author just saved should not be null");
            Assert.AreEqual(author.AuthorId, saved.AuthorId, "Author ID not saved correctly");
            Assert.AreEqual(author.UserName, saved.UserName, "UserName not saved correctly");
            Assert.AreEqual(author.DisplayName, saved.DisplayName, "DisplayName not saved correctly");
            Assert.AreEqual(author.PasswordHash, saved.PasswordHash, "PasswordHash not saved correctly");
        }