public void TestInitIndicatorMetadata()
        {
            List<Grouping> grouping = new List<Grouping>{
                new Grouping { IndicatorId = IndicatorIds.LifeExpectancyAtBirth},
                new Grouping { IndicatorId = IndicatorIds.IncidenceOfMalignantMelanoma}
            };

            GroupData data = new GroupData();
            data.InitIndicatorMetadata(IndicatorMetadataRepository.Instance.GetIndicatorMetadataCollection(grouping));

            Assert.AreEqual(2, data.IndicatorMetadata.Count);
            Assert.IsNotNull(data.GetIndicatorMetadataById(IndicatorIds.LifeExpectancyAtBirth));
            Assert.IsNull(data.GetIndicatorMetadataById(IndicatorIds.AdultDrugMisuse));
        }
        public GroupData Build()
        {
            GroupData = new GroupData();

            try
            {
                ReadGroupings(GroupDataReader);
                if (Groupings.Count > 0)
                {
                    if (AssignAreas)
                    {
                        GroupData.Areas = GetChildAreas();
                    }

                    GroupData.InitIndicatorMetadata(
                        IndicatorMetadataRepository.Instance.GetIndicatorMetadataCollection(Groupings));
                    BuildGroupRoots();

                    if (AssignData)
                    {
                        AssignCoreData();
                    }

                    // Assign trend markers
                    var profileReader = ReaderFactory.GetProfileReader();
                    ProfileConfig profileConfig = profileReader.GetProfileConfig(ProfileId);
                    if (profileConfig != null && profileConfig.HasTrendMarkers)
                    {
                        AssignRecentTrends();
                    }
                }
                else
                {
                    GroupData.Clear();
                }
            }
            catch (Exception ex)
            {
                ExceptionLog.LogException(ex, "");
            }
            return GroupData;
        }