public void It_has_a_constructor_that_takes_an_IdmResource_without_Creator()
        {
            var resource = new IdmResource
            {
                DisplayName = "My Display Name",
            };
            var it = new PortalUIConfiguration(resource);

            Assert.AreEqual("My Display Name", it.DisplayName);
            Assert.IsNull(it.Creator);
        }
        public void It_has_a_constructor_that_takes_an_IdmResource()
        {
            var resource = new IdmResource
            {
                DisplayName = "My Display Name",
                Creator = new Person { DisplayName = "Creator Display Name", ObjectID = "Creator ObjectID"},
            };
            var it = new PortalUIConfiguration(resource);

            Assert.AreEqual("PortalUIConfiguration", it.ObjectType);
            Assert.AreEqual("My Display Name", it.DisplayName);
            Assert.AreEqual("Creator Display Name", it.Creator.DisplayName);
        }
        private static HeaderViewModel CreateHeaderViewModel(int clientId, int portalId, PortalType portalType, PortalUIConfiguration configuration, string selectedModule)
        {
            try
            {
                HeaderViewModel headerViewModel = new HeaderViewModel();
                headerViewModel.NavigationList = new List<SelectListItem>();
                headerViewModel.BeforePortal = configuration.BeforePortal;
                headerViewModel.portalId = portalId;
                headerViewModel.clientId = clientId;
                headerViewModel.portalType = portalType;

                List<PortalModule> OrderedModuleList = configuration.Modules.OrderBy(x => x.DisplayOrder).ToList();
                List<PortalModule> SelectedModuleList = OrderedModuleList.Where(x => x.Display == true).ToList();
                if (configuration.ShowPortalNavigation)
                {
                    foreach (PortalModule module in SelectedModuleList)
                    {
                        SelectListItem navItem = new SelectListItem() { Text = module.ModuleName, Value = module.ModuleType, Selected = false };
                        if (module.ModuleType == selectedModule)
                        {
                            navItem.Selected = true;
                        }
                        if (module.ModuleType == "articles")
                        {
                            navItem.Value = "article";
                        }
                        headerViewModel.NavigationList.Add(navItem);
                    }
                }
                if (HttpContext.Current.Session["UserSession_" + portalId.ToString()] != null)
                {
                    var usr = (User)HttpContext.Current.Session["UserSession_" + portalId.ToString()];
                    if (usr != null)
                    {
                        headerViewModel.isActiveDiretoryUser = usr.isActiveDirectoryUser;
                    }

                }
                return headerViewModel;
            }
            catch (Exception ex)
            {
                KBCustomException kbCustExp = KBCustomException.ProcessException(ex, KBOp.CreateViewModel, KBErrorHandler.GetMethodName(), GeneralResources.CreateViewModelError,
                    new KBExceptionData("clientId", clientId), new KBExceptionData("portalType", portalType), new KBExceptionData("selectedModule", selectedModule), new KBExceptionData("configuration.AfterPortal", configuration.AfterPortal));
                throw kbCustExp;
            }
        }
 private static FooterViewModel CreateFooterViewModel(PortalUIConfiguration configuration)
 {
     try
     {
         FooterViewModel footerViewModel = new FooterViewModel();
         footerViewModel.Content = configuration.AfterPortal;
         return footerViewModel;
     }
     catch (Exception ex)
     {
         KBCustomException kbCustExp = KBCustomException.ProcessException(ex, KBOp.CreateViewModel, KBErrorHandler.GetMethodName(), GeneralResources.CreateViewModelError,
             new KBExceptionData("configuration.BeforePortal", configuration.BeforePortal), new KBExceptionData("configuration.AfterPortal", configuration.AfterPortal));
         throw kbCustExp;
     }
 }
 public static CommonViewModel CreateCommonViewModel(int clientId, int portalId, PortalType portalType, PortalUIConfiguration configuration, string selectedModule)
 {
     CommonViewModel commonViewModel = new CommonViewModel();
     commonViewModel.HeaderViewModel = CreateHeaderViewModel(clientId, portalId, portalType, configuration, selectedModule);
     commonViewModel.FooterViewModel = CreateFooterViewModel(configuration);
     return commonViewModel;
 }
 public PortalUIConfigurationTests()
 {
     _it = new PortalUIConfiguration();
 }