/// <summary> /// CurrentCachedSIMPLLoginTrackerRecord method /// </summary> /// <param name="userName"></param> /// <returns></returns> public static SIMPLLoginTracker CurrentCachedSIMPLLoginTrackerRecord(string userName) { if (string.IsNullOrWhiteSpace(userName)) { throw new ArgumentException("Parameter is null or whitespace", "userName"); } var cacheKey = GetCacheKey(userName); if (Cache[cacheKey] == null) { var myErrorLoggingService = new ErrorLoggingService(); var mySIMPLSessionEntities = new SIMPLSessionEntitiesCustom(); var mySIMPLAdminEntitiesRepository = new SIMPLSessionEntitiesRepository(myErrorLoggingService, mySIMPLSessionEntities); var myLoginTracker = mySIMPLAdminEntitiesRepository.GetSIMPLLoginTrackerRecord(userName); GuardsForSIMPLLoginTracker(myLoginTracker); AddToOrUpdateCache(cacheKey, myLoginTracker, TypesCacheExpirationTimeInSeconds); } return Cache[cacheKey] as SIMPLLoginTracker; }
public void MyTestInitialize() { using (ShimsContext.Create()) { // Set up the LoginControllerForTests LoginControllerForTests = DependencyResolver.Current.GetService<LoginController>(); // Set up the LoginViewModelForTests var logout = new Logout(); var myErrorLoggingService = new ErrorLoggingService(); var mySingleConcurrentLoginRules = new SingleConcurrentLoginRules(); var mySIMPLSessionEntitiesRepository = new SIMPLSessionEntitiesRepository(myErrorLoggingService); var mySingleConConcurrentLoginManager = new SingleConcurrentLoginManager(mySingleConcurrentLoginRules, myErrorLoggingService, mySIMPLSessionEntitiesRepository); LoginViewModelForTests = new LoginViewModel(logout, myErrorLoggingService, mySingleConcurrentLoginRules, mySingleConConcurrentLoginManager, mySIMPLSessionEntitiesRepository); ConfigControllerForTests = DependencyResolver.Current.GetService<ConfigController>(); } }