private IList<IArea> GetParentAreas()
 {
     var listBuilder = new AreaListProvider(areasReader);
     if (Area.IsNearestNeighbour(_parameters.NearestNeighbourCode))
     {
         listBuilder.CreateAreaListFromNearestNeighbourAreaCode(_parameters.ProfileId, _parameters.NearestNeighbourCode);
     }
     else
     {
         listBuilder.CreateAreaListFromAreaTypeId(_parameters.ProfileId, _parameters.ParentAreaTypeId);
     }
     return listBuilder.Areas;
 }
        public void TestCreateAreaListFromNearestNeighbourAreaCode()
        {
            const string code = AreaCodes.NearestNeighbours_Derby;
            var nn = new NearestNeighbourArea(code);
            IAreasReader areasReader = ReaderFactory.GetAreasReader();

            var builder = new AreaListProvider(areasReader);
            builder.CreateAreaListFromNearestNeighbourAreaCode(
                ProfileIds.ChildrenAndYoungPeoplesBenchmarkingTool, code);

            // Check areas
            var areas = builder.Areas;
            Assert.IsNotNull(areas);

            // Check order of Nearest Neighbours
            var sortedNearestNeighboursByRank = areasReader.GetNearestNeighbours(nn.Code, 1);
            for (var i = 0; i < sortedNearestNeighboursByRank.Count; i++)
            {
                Assert.AreEqual(sortedNearestNeighboursByRank[i].NeighbourAreaCode, areas[i].Code);
            }
        }