public void AdvancedUrlRewriter_PrimaryPortalAlias(Dictionary <string, string> testFields) { string defaultAlias = testFields["DefaultAlias"]; var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]); settings.PortalId = PortalId; string language = testFields["Language"].Trim(); string skin = testFields["Skin"].Trim(); if (!String.IsNullOrEmpty(language)) { _customLocale = new Locale { Code = language, Fallback = "en-US" }; _customLocale.Text = CultureInfo.CreateSpecificCulture(_customLocale.Code).NativeName; Localization.SaveLanguage(_customLocale); Localization.AddLanguageToPortals(_customLocale.LanguageId); } if (testFields.ContainsKey("Final Url")) { testFields["Final Url"] = testFields["Final Url"].Replace("{useAlias}", defaultAlias); } PortalController.UpdatePortalSetting(PortalId, "PortalAliasMapping", "REDIRECT"); var alias = PortalAliasController.Instance.GetPortalAlias(defaultAlias, PortalId); if (alias == null) { alias = new PortalAliasInfo { HTTPAlias = defaultAlias, PortalID = PortalId, IsPrimary = true }; if (!(String.IsNullOrEmpty(language) && String.IsNullOrEmpty(skin))) { alias.CultureCode = language; alias.Skin = skin; } PortalAliasController.Instance.AddPortalAlias(alias); } SetDefaultAlias(defaultAlias); ExecuteTest(settings, testFields, false); alias = PortalAliasController.Instance.GetPortalAlias(defaultAlias, PortalId); if (alias != null) { PortalAliasController.Instance.DeletePortalAlias(alias); } }
public void AdvancedUrlRewriter_0_PrimaryPortalAlias(Dictionary <string, string> testFields) { var defaultAlias = testFields["DefaultAlias"]; var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"], this.PortalId); var language = testFields["Language"].Trim(); var skin = testFields["Skin"].Trim(); if (!string.IsNullOrEmpty(language)) { this.customLocale = new Locale { Code = language, Fallback = "en-US" }; this.customLocale.Text = CultureInfo.GetCultureInfo(this.customLocale.Code).NativeName; Localization.SaveLanguage(this.customLocale); Localization.AddLanguageToPortals(this.customLocale.LanguageId); } if (testFields.ContainsKey("Final Url")) { testFields["Final Url"] = testFields["Final Url"].Replace("{useAlias}", defaultAlias); } PortalController.UpdatePortalSetting(this.PortalId, "PortalAliasMapping", "REDIRECT", true, "en-us"); var portalAliasService = Globals.DependencyProvider.GetRequiredService <IPortalAliasService>(); var alias = portalAliasService.GetPortalAlias(defaultAlias, this.PortalId); if (alias == null) { alias = new PortalAliasInfo(); alias.HttpAlias = defaultAlias; alias.PortalId = this.PortalId; alias.IsPrimary = true; if (!(string.IsNullOrEmpty(language) && string.IsNullOrEmpty(skin))) { alias.CultureCode = language; alias.Skin = skin; } portalAliasService.AddPortalAlias(alias); } this.SetDefaultAlias(defaultAlias); this.ExecuteTest(settings, testFields, false); alias = portalAliasService.GetPortalAlias(defaultAlias, this.PortalId); if (alias != null) { portalAliasService.DeletePortalAlias(alias); } }
public void AdvancedUrlRewriter_PrimaryPortalAlias(Dictionary <string, string> testFields) { string defaultAlias = testFields["DefaultAlias"]; var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]); settings.PortalId = PortalId; string language = testFields["Language"].Trim(); string skin = testFields["Skin"].Trim(); if (!String.IsNullOrEmpty(language)) { _customLocale = new Locale { Code = language, Fallback = "en-US" }; _customLocale.Text = CultureInfo.CreateSpecificCulture(_customLocale.Code).NativeName; Localization.SaveLanguage(_customLocale); Localization.AddLanguageToPortals(_customLocale.LanguageId); } if (testFields.ContainsKey("Final Url")) { testFields["Final Url"] = testFields["Final Url"].Replace("{useAlias}", defaultAlias); } if (!(String.IsNullOrEmpty(language) && String.IsNullOrEmpty(skin))) { //add new primary alias _primaryAlias = new PortalAliasInfo { PortalID = PortalId, HTTPAlias = defaultAlias, CultureCode = language, Skin = skin, IsPrimary = true }; _primaryAlias.PortalAliasID = TestablePortalAliasController.Instance.AddPortalAlias(_primaryAlias); ExecuteTest(settings, testFields, true); } else { SetDefaultAlias(defaultAlias); ExecuteTest(settings, testFields, false); } }
public void AdvancedUrlProvider_PrimaryPortalAlias(Dictionary <string, string> testFields) { string defaultAlias = testFields["DefaultAlias"]; string redirectMode = testFields["RedirectMode"]; var settings = UrlTestFactoryClass.GetSettings("FriendlyUrl", "PrimaryPortalAlias"); string language = testFields["Language"].Trim(); if (!String.IsNullOrEmpty(language)) { _customLocale = new Locale { Code = language, Fallback = "en-US" }; _customLocale.Text = CultureInfo.CreateSpecificCulture(_customLocale.Code).NativeName; Localization.SaveLanguage(_customLocale); Localization.AddLanguageToPortals(_customLocale.LanguageId); //add new primary alias _primaryAlias = new PortalAliasInfo { PortalID = PortalId, HTTPAlias = defaultAlias, CultureCode = language, IsPrimary = true }; _primaryAlias.PortalAliasID = TestablePortalAliasController.Instance.AddPortalAlias(_primaryAlias); } else { SetDefaultAlias(defaultAlias); } PortalController.UpdatePortalSetting(PortalId, "PortalAliasMapping", redirectMode); ExecuteTest("Improved", settings, testFields); }