public ComparatorMap LimitByParentArea(ParentArea parentArea)
 {
     ComparatorMap map = new ComparatorMap();
     IEnumerable<Comparator> result = comparators.Where(c => c.ChildAreaTypeId == parentArea.ChildAreaTypeId &&
         c.Area.Code == parentArea.AreaCode);
     foreach (var comparator in result)
     {
         map.Add(comparator);
     }
     return map;
 }
 public void TestCannotAddNullComparator()
 {
     ComparatorMap map = new ComparatorMap();
     map.Add(null);
     Assert.AreEqual(0, map.Count);
 }
        private Limits GetLimits(Grouping grouping,  bool excludeComparators)
        {
            var areaCodes = new List<string>
            {
                AreaCodes.CountyUa_Cambridgeshire,
                AreaCodes.CountyUa_Bedford
            };

            var comparatorMap = new ComparatorMap();
            comparatorMap.Add(new Comparator
            {
                Area = AreaFactory.NewArea(areasReader, AreaCodes.Gor_EastOfEngland),
                ChildAreaTypeId = AreaTypeIds.CountyAndUnitaryAuthority,
                ComparatorId = ComparatorIds.Subnational
            });
            comparatorMap.Add(new Comparator
            {
                Area = AreaFactory.NewArea(areasReader, AreaCodes.England),
                ChildAreaTypeId = AreaTypeIds.CountyAndUnitaryAuthority,
                ComparatorId = ComparatorIds.England
            });

            var limitsBuilder = new LimitsBuilder()
            {
                ExcludeComparators = excludeComparators
            };
            return limitsBuilder.GetLimits(areaCodes, grouping, comparatorMap);
        }