public void GetIndicatorByIdTest()
 {
     IndicatorDAO target = new IndicatorDAO(connnetion);
     int providerId = 1;
     int indicatorId = 1;
     Indicator expected = new Indicator
     {
         ID = 1,
         Name = "Densidade populacional (N.º/ km²) por Local de residência; Anual",
         NameAbbr = "Densidade populacional (N.º/ km²)",
         Provider = new Provider
         {
             ID = 1,
             Name = "Instituto Nacional de Estatística",
             NameAbbr = "INE",
             ServiceURL = "http://localhost:42136/INEStatisticsProvider.svc",
             URL = "http://www.ine.pt"
         },
         SourceID = "0000009",
         SubThemeID = 1,
         ThemeID = 1
     };
     Indicator actual;
     actual = target.GetIndicatorById(providerId, indicatorId);
     Assert.AreEqual(expected, actual);
 }
示例#2
0
        private static void addIndicators(DbConnection conn, Provider p, IEnumerable<ExtendedSubTheme> subthemes, INEService.Statistics ine)
        {
            Console.WriteLine(":::::::::: Adding indicatores :::::::::");

            var indicatorDAO = new IndicatorDAO(conn);

            foreach (var subtheme in subthemes)
            {
                INEService.IndicatorPlus indicators = ine.GetIndicatorsByTheme(GEOVERSION, subtheme.SourceThemeCode, LANGUAGE, 2, 1, 10000);
                foreach (var indicator in indicators.Indicators)
                {
                    Console.WriteLine("... Adding indicator: {0} ....", subtheme.NameAbbr);

                    Indicator convertedIndicator = new Indicator
                    {
                        Name = indicator.Designation,
                        NameAbbr = indicator.Abbreviation,
                        Provider = p,
                        SourceID = indicator.Code,
                        SubThemeID = subtheme.ID,
                        ThemeID = subtheme.ThemeID
                    };
                    convertedIndicator.ID = indicatorDAO.AddIndicator(convertedIndicator);

                    addConfiguration(conn, convertedIndicator, indicator.GeoLevelCode);
                }
            }
        }
 public void GetIndicatorsByProviderIdTest()
 {
     IndicatorDAO target = new IndicatorDAO(connnetion);
     int providerId = 1;
     Nullable<int> page = new Nullable<int>(1);
     Nullable<int> recordsPerPage = new Nullable<int>(1);
     IEnumerable<Indicator> actual;
     actual = target.GetIndicatorsByProviderId(providerId, page, recordsPerPage);
     Assert.AreNotEqual(actual, null);
     Assert.AreEqual(actual.Count(), 1);
 }
 public void IndicatorDAOConstructorTest()
 {
     IndicatorDAO target = new IndicatorDAO(connnetion);
     Assert.AreNotEqual(target, null);
 }
 public void GetTotalIndicatorsTest()
 {
     IndicatorDAO target = new IndicatorDAO(connnetion);
     int providerId = 1;
     long expected = 1;
     long actual;
     actual = target.GetTotalIndicators(providerId, null, null);
     Assert.AreEqual(expected, actual);
 }
 public void GetTotalIndicatorsByThemesTest()
 {
     IndicatorDAO target = new IndicatorDAO(connnetion);
     int providerId = 1;
     Nullable<int> themeId = new Nullable<int>(1);
     Nullable<int> subThemeId = new Nullable<int>(1);
     long expected = 1;
     long actual;
     actual = target.GetTotalIndicators(providerId, themeId, subThemeId);
     Assert.AreEqual(expected, actual);
 }