public void When_Specific_Profile_Then_Only_Area_Types_Used_As_Child_Area_Types_Are_Included()
        {
            NameValueCollection nameValues = new NameValueCollection();
            nameValues.Add(ParameterNames.ProfileId, ProfileIds.Phof.ToString());
            var parameters = new ParentAreaGroupsParameters(nameValues);
            var areaTypes =  new JsonBuilderParentAreaGroups(parameters).GetChildAreaTypeIdToParentAreaTypes();

            Assert.IsTrue(areaTypes.Select(x => x.Id).ToList().Contains(AreaTypeIds.CountyAndUnitaryAuthority));
            Assert.IsFalse(areaTypes.Select(x => x.Id).ToList().Contains(AreaTypeIds.Ccg));
        }
        public void When_Profile_Not_Defined_Then_All_Area_Types_Included()
        {
            NameValueCollection nameValues = new NameValueCollection();
            nameValues.Add(ParameterNames.ProfileId, ProfileIds.Undefined.ToString());
            var parameters = new ParentAreaGroupsParameters(nameValues);
            var areaTypes = new JsonBuilderParentAreaGroups(parameters).GetChildAreaTypeIdToParentAreaTypes();

            Assert.IsTrue(areaTypes.Select(x => x.Id).ToList().Contains(AreaTypeIds.CountyAndUnitaryAuthority));
            Assert.IsTrue(areaTypes.Select(x => x.Id).ToList().Contains(AreaTypeIds.Ccg));
        }
        public IList<IAreaType> GetAreaTypesWithParentAreaTypes(int profile_id = ProfileIds.Undefined, int? template_profile_id = null)
        {
            try
            {
                NameValueCollection nameValues = new NameValueCollection();
                nameValues.Add(ParameterNames.ProfileId, profile_id.ToString());

                if (template_profile_id.HasValue)
                {
                    nameValues.Add(ParameterNames.TemplateProfileId, template_profile_id.ToString());
                }

                var parameters = new ParentAreaGroupsParameters(nameValues);
                return new JsonBuilderParentAreaGroups(parameters).GetChildAreaTypeIdToParentAreaTypes();
            }
            catch (Exception ex)
            {
                Log(ex);
                throw;
            }
        }
 public JsonBuilderParentAreaGroups(ParentAreaGroupsParameters parameters)
 {
     _parameters = parameters;
     Parameters = _parameters;
 }
 public JsonBuilderParentAreaGroups(HttpContextBase context)
     : base(context)
 {
     _parameters = new ParentAreaGroupsParameters(context.Request.Params);
     Parameters = _parameters;
 }