/// <summary> /// /// </summary> /// <param name="testRoleId"></param> private void StubUserContext(int testRoleId) { IDataContext dataContext = new ArtDatabanken.Data.Fakes.StubIDataContext() { }; ILocale locale = new Locale( AnalysisPortalTestSettings.Default.SwedishLocaleId, AnalysisPortalTestSettings.Default.SwedishLocale, AnalysisPortalTestSettings.Default.SwedishNameString, AnalysisPortalTestSettings.Default.SvenskNameString, dataContext); IUser user = this.GetUser(this.userContext, dataContext); this.userContext = new ArtDatabanken.Data.Fakes.StubIUserContext() { LocaleSetILocale = (value) => locale = value, LocaleGet = () => locale, UserGet = () => user, CurrentRoleGet = () => { return (this.GetAnalysisPortalRole( "TestUser", testRoleId, this.userContext)); } }; }
private ILocale StubApplicationUserContex(int testRoleId) { IDataContext applicationDataContext = new ArtDatabanken.Data.Fakes.StubIDataContext() { }; ILocale applicationLocale = new Locale( AnalysisPortalTestSettings.Default.SwedishLocaleId, AnalysisPortalTestSettings.Default.SwedishLocale, AnalysisPortalTestSettings.Default.SwedishNameString, AnalysisPortalTestSettings.Default.SvenskNameString, applicationDataContext); IUser applicationUser = this.GetApplicationUser(this.applicationUserContext, applicationDataContext); this.applicationUserContext = new ArtDatabanken.Data.Fakes.StubIUserContext() { LocaleSetILocale = (value) => applicationLocale = value, LocaleGet = () => applicationLocale, UserGet = () => applicationUser, CurrentRoleGet = () => { return (this.GetAnalysisPortalRole ( AppSettings .Default .ApplicationUserName, testRoleId, this .applicationUserContext)); } }; return(applicationLocale); }