Exemple #1
0
        public void UserManagementServices_Constructor_ShouldReturnArgumentNullException()
        {
            DatabaseContext        temp  = new DatabaseContext();
            UserManagementServices temp2 = new UserManagementServices(temp);
            //Arrange
            bool exceptionRaised = false;
            bool expected        = true;

            try
            {
                UserManagementServices userManagementServ = new UserManagementServices(null);
            }
            catch (ArgumentNullException)
            {
                exceptionRaised = true;
            }

            Assert.Equal(expected, exceptionRaised);
        }
Exemple #2
0
        } // end of HasHigherPrivilege()

        /// <summary>
        /// Finds level of user by trarvese back to the root using referenced parent Id
        /// </summary>
        /// <param name="user"></param> can't be null or it will throw an exception
        /// <returns> level </returns>
        public int FindHeight(Account user)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user", "user can't be null.");
            }

            UserManagementServices uMS = new UserManagementServices(new DatabaseContext());
            int level = 0;

            while (user.ParentUser_Id != null)
            {
                int parentId = (int)user.ParentUser_Id;
                user   = uMS.FindById(parentId);
                level += 1;
            }

            return(level);
        }
 public SsoManager()
 {
     _db = new DatabaseContext();
     _userManagementServices = new UserManagementServices(_db);
 }
 public UserServiceTest()
 {
     _httpClientFactory = new APIClientHelperFactory("fa114107311259f5f33e70a5d85de34a2499b4401da069af0b1d835cd5ec0d56", "https://gorest.co.in/public-api/");
     _sout = new UserManagementServices(_httpClientFactory);
 }
 /// <summary>
 /// Constructor that accept a username of account and initiaize the UserManagementServices
 /// User Account has to exist in database
 /// </summary>
 /// <param name="requestingUserName"></param>
 public UserManager()
 {
     _DbContext = new DatabaseContext();
     _userManagementServices = new UserManagementServices(_DbContext);
 }