public void MyTestInitialize() { //Set applicatiobn start parameters that will be set in Global.asax.cs-Application_Start()) //CoreData.CountryManager = new CountryManagerMultiThreadCache(); //CoreData.LocaleManager = new LocaleManagerMultiThreadCache(); //CoreData.TaxonManager = new TaxonManagerMultiThreadCache(); //CoreData.UserManager = new UserManagerMultiThreadCache(); //CoreData.RegionManager = new RegionManagerMultiThreadCache(new CoordinateSystem()); //Set session helper for handling HttpContext data. sessionHelper = new DictionarySessionHelper(); SessionHandler.SetSessionHelper(sessionHelper); //Stub Data including set up of application user context. StubDataSourceAndManagerData(); sessionHelper.SetInSession("applicationUserContext", applicationUserContext); sessionHelper.SetInSession("userContext", applicationUserContext); sessionHelper.SetInSession("ApplicationContext:en-GB", applicationUserContext); sessionHelper.SetInSession("mySettings", new MySettings()); sessionHelper.SetInSession("results", new CalculatedDataItemCollection()); // Set Session start parameters that will be set in Global.asax.cs-Session_Start(object sender, EventArgs e) sessionHelper.SetInSession("language", "en-GB"); sessionHelper.SetInSession("mySettings", new MySettings()); sessionHelper.SetInSession("results", new CalculatedDataItemCollection()); // Set language that will be set in Global.asax.cs-Application_BeginRequest(object sender, EventArgs e) Thread.CurrentThread.CurrentUICulture = new CultureInfo(SessionHelper.GetFromSession <string>("language")); Thread.CurrentThread.CurrentCulture = new CultureInfo(SessionHelper.GetFromSession <string>("language")); }
/// <summary> /// The remove user context set on test start. /// </summary> protected void RemoveUserContextSetOnTestStart() { sessionHelper.SetInSession <IUserContext>(DyntaxaSettings.Default.ApplicationContextCacheKey + DyntaxaTestSettings.Default.EnglishLocale, null); sessionHelper.SetInSession <IUserContext>(DyntaxaSettings.Default.ApplicationContextCacheKey, null); sessionHelper.SetInSession <IUserContext>(DyntaxaSettings.Default.ApplicationContextCacheKey + DyntaxaTestSettings.Default.SwedishLocale, null); }
protected void LoginTestUser() { sessionHelper.SetInSession("userContext", testUserContext); }
protected void RemoveUserContextSetOnTestStart() { sessionHelper.SetInSession <IUserContext>("userContext", null); sessionHelper.SetInSession <IUserContext>("ApplicationContext:en-GB", null); sessionHelper.SetInSession <IUserContext>("ApplicationContext:", null); }