public void TestZeroIndicatorIdsIsValid()
 {
     NameValueCollection nameValues = GetValidParameters();
     GroupDataAtDataPointBySearchParameters parameters = new GroupDataAtDataPointBySearchParameters(nameValues);
     nameValues[GroupDataAtDataPointBySearchParameters.ParameterIndicatorIds] = "";
     Assert.IsTrue(parameters.AreValid);
 }
        public void TestValidParameters()
        {
            NameValueCollection nameValues = GetValidParameters();
            GroupDataAtDataPointBySearchParameters parameters = new GroupDataAtDataPointBySearchParameters(nameValues);
            Assert.AreEqual(AreaCodes.Sha_EastOfEngland, parameters.ParentAreaCode);
            Assert.IsTrue(parameters.IndicatorIds.Contains(2) && parameters.IndicatorIds.Contains(3));

            Assert.IsTrue(parameters.AreValid);
        }
 public void TestRestrictedProfileId()
 {
     // Both restricted and profile id set
     NameValueCollection nameValues = GetValidParameters();
     nameValues.Add(ParameterNames.ProfileId, "1");
     nameValues.Add(ParameterNames.RestrictToProfileId, "1,2");
     GroupDataAtDataPointBySearchParameters parameters = new GroupDataAtDataPointBySearchParameters(nameValues);
     Assert.AreEqual(2, parameters.RestrictResultsToProfileIdList.Count);
     Assert.AreEqual(1, parameters.ProfileId);
 }
 public JsonBuilderGroupDataAtDataPointBySearch(GroupDataAtDataPointBySearchParameters parameters)
 {
     _parameters = parameters;
     Parameters = _parameters;
 }
 public JsonBuilderGroupDataAtDataPointBySearch(HttpContextBase context)
     : base(context)
 {
     _parameters = new GroupDataAtDataPointBySearchParameters(context.Request.Params);
     Parameters = _parameters;
 }
        public IList<GroupRoot> GetGroupDataAtDataPoint(int area_type_id, string parent_area_code, string indicator_ids, string restrict_to_profile_ids)
        {
            try
            {
                NameValueCollection nameValues = new NameValueCollection();
                nameValues.Add(DataParameters.ParameterIndicatorIds, indicator_ids);
                nameValues.Add(ParameterNames.RestrictToProfileId, restrict_to_profile_ids);
                nameValues.Add(ParameterNames.AreaTypeId, area_type_id.ToString());
                nameValues.Add(ParameterNames.ParentAreaCode, parent_area_code);

                var parameters = new GroupDataAtDataPointBySearchParameters(nameValues);
                return new JsonBuilderGroupDataAtDataPointBySearch(parameters).GetGroupRoots();
            }
            catch (Exception ex)
            {
                Log(ex);
                throw;
            }
        }