protected void InitPageModel()
        {  
            ProfileCollectionBuilder = new ProfileCollectionBuilder(ReaderFactory.GetProfileReader(), appConfig);
            NewPageModel();

            var versionFolder = appConfig.JavaScriptVersionFolder;

            PageModel.CoreServicesUrl = appConfig.CoreWsUrl;
            PageModel.UseMinifiedJavaScript = appConfig.UseMinifiedJavaScript;

            PageModel.SetJavaScriptVersionFolder(versionFolder);
            PageModel.Skin = SkinFactory.GetSkin();

            PageModel.ProfileCollections = new List<ProfileCollection>();
            PageModel.ProfileCollectionIdList = new int[] { };

            PageModel.NationalProfileCollection = ProfileCollectionBuilder.GetCollection(ProfileCollectionIds.NationalProfiles);

            SetBridgeServicesUrl();
            ViewBag.ImagesUrl = appConfig.StaticContentUrl + versionFolder + "images/";
            ViewBag.PdfUrl = appConfig.PdfUrl;
            ViewBag.UseGoogleAnalytics = appConfig.UseGoogleAnalytics;
            ViewBag.JavaScriptVersion = versionFolder;
            ViewBag.ShowCancer = appConfig.ShowCancer;
            ViewBag.ShowNearestNeighbours = appConfig.ShowNearestNeighbours;
            ViewBag.FeatureSwitch = appConfig.FeatureSwitch;
        }
        public void TestGetCollection_NationalProfiles()
        {
            var parameters = new NameValueCollection();
            parameters.Add("Environment","Live");

            var profileCollection = new ProfileCollectionBuilder(ReaderFactory.GetProfileReader(), new AppConfig(parameters))
                .GetCollection(ProfileCollectionIds.NationalProfiles);

            Assert.IsNotNull(profileCollection);
            Assert.IsTrue(profileCollection.ProfileCollectionItems.Any());

            // Assert ExternalUrl has been assigned where profile has own skin
            var url = profileCollection.ProfileCollectionItems.First(x => x.ProfileDetails.HasExclusiveSkin).ExternalUrl;
            Assert.IsFalse(string.IsNullOrEmpty(url));
        }
        public void SetProfileCollection(ProfileDetails details, string leadProfileUrlKey)
        {
            ViewBag.IsPageRootProfileCollection = true;
            ViewBag.LeadProfileUrlKey = leadProfileUrlKey;

            // Get appropriate profile details
            var profileDetails = details.ProfileUrlKey == leadProfileUrlKey
                ? details
                : new ProfileDetailsBuilder(leadProfileUrlKey).Build();

            var profileCollectionBuilder = new ProfileCollectionBuilder(ReaderFactory.GetProfileReader(), appConfig);

            PageModel.ProfileCollections = new ProfileCollectionListBuilder(profileCollectionBuilder)
                .GetProfileCollections(leadProfileUrlKey, profileDetails.ProfileCollectionIds);
        }