示例#1
0
        public void UserManagementServiceUT_RemoveEmailCode_RemoveEmailCodeForUserSuccess(bool isTemp, string username, string name, string email,
                                                                                          string phoneNumber, string password, int disabled, string userType, string salt, string emailCode, long emailCodeTimestamp)
        {
            // Arrange: Create a user.
            bool createResult = UserManagementServiceUT.CreateUser(isTemp, username, name, email, phoneNumber, password, disabled, userType, salt);

            Assert.IsTrue(createResult);

            // Arrange: Store an email code for that user.
            bool storeResult = UserManagementServiceUT.StoreEmailCode(username, emailCode, emailCodeTimestamp);

            Assert.IsTrue(storeResult);

            // Act: Remove the email code for that user.
            bool result = UserManagementServiceUT.RemoveEmailCode(username);

            Assert.IsTrue(result);

            // Read that user and check if infact that email code is removed.
            UserObject user = UserManagementServiceUT.GetUserInfo(username);
            bool       readResult;

            if (user.TempTimestamp == 0 && user.Username == username && user.Name == name && user.Email == email &&
                user.PhoneNumber == phoneNumber && user.Password == password && user.Disabled == disabled && user.UserType == userType && user.Salt == salt &&
                user.EmailCode == "" && user.EmailCodeTimestamp == 0 && user.EmailCodeFailures == 0)
            {
                readResult = true;
            }
            else
            {
                readResult = false;
            }
            Assert.IsTrue(readResult);

            // Cleanup: Delete that user
            bool deleteResult = UserManagementServiceUT.DeleteUser(username);

            Assert.IsTrue(deleteResult);
        }