public void AddUserTest()
        {
            UserSqlDAO access = new UserSqlDAO(connectionString);

            User user = access.AddUser("anotheruser", "password", "admin");

            Assert.IsNotNull(user);

            Assert.AreEqual("admin", user.Role);

            user = access.GetUser("anotheruser");

            Assert.IsNotNull(user);

            Assert.AreEqual("admin", user.Role);
        }
Пример #2
0
        public void AddUserTest()
        {
            // Arrange
            string username          = "******";
            string password          = "******";
            User   previousMaxUserId = GetUserWithMaxUserId();

            // Act
            User user       = dao.AddUser("test6", "test6");
            User newUserMax = GetUserWithMaxUserId();

            // Assert
            Assert.IsNotNull(user);
            Assert.IsTrue(user.UserId == previousMaxUserId.UserId + 1);
            Assert.IsTrue(user.Username == newUserMax.Username);
            Assert.IsTrue(user.PasswordHash == newUserMax.PasswordHash);
        }