Exemplo n.º 1
0
 public void GetProviderThemesTest()
 {
     ThemesDAO target = new ThemesDAO(connnetion);
     int providerId = 1;
     Theme expected = new Theme
     {
         ID = 1,
         Name = "Território",
         NameAbbr = "Território",
         ProviderID = 1
     };
     IEnumerable<Theme> actual = target.GetProviderThemes(providerId);
     Assert.AreEqual(1, actual.Count());
     Assert.AreEqual(expected, actual.ElementAt(0));
 }
Exemplo n.º 2
0
 public void GetProviderSubThemesTest()
 {
     ThemesDAO target = new ThemesDAO(connnetion);
     int providerId = 1;
     int themeId = 1;
     SubTheme expected = new SubTheme
     {
         ID = 1,
         Name = "Ordenamento do território",
         NameAbbr = "Ordenamento do território",
         ProviderID = 1,
         ThemeID = 1
     };
     IEnumerable<SubTheme> actual;
     actual = target.GetProviderSubThemes(providerId, themeId);
     Assert.AreEqual(1, actual.Count());
     Assert.AreEqual(expected, actual.ElementAt(0));
 }
Exemplo n.º 3
0
        static IEnumerable<ExtendedSubTheme> AddThemes(DbConnection conn, Provider p, INEService.Statistics ine)
        {
            Console.WriteLine(":::::::::: Adding themes :::::::::");

            var themesDAO = new ThemesDAO(conn);

            var insertedThemes = new List<ExtendedTheme>();
            var insertedSubThemes = new List<ExtendedSubTheme>();

            INEService.Theme[] themes = ine.GetThemes(GEOVERSION, 2, LANGUAGE, 1, 100000);
            var filteredThemes = themes.Where(t => t.ThemeLevel == 2);
            foreach (var theme in filteredThemes)
            {
                Console.WriteLine("... Adding theme: {0} ....", theme.Designation);

                ExtendedTheme t = new ExtendedTheme
                {
                    Name = theme.Designation,
                    NameAbbr = theme.Designation,
                    ProviderID = p.ID,
                    SourceThemeCode = theme.Code
                };
                t.ID = themesDAO.AddTheme(t);

                insertedThemes.Add(t);
            }

            // subthemes
            var filteredSubThemes = themes.Where(t => t.ThemeLevel == 3);
            foreach (var subtheme in filteredSubThemes)
            {
                Console.WriteLine("... Adding subtheme: {0} ....", subtheme.Designation);

                ExtendedSubTheme sub = new ExtendedSubTheme
                {
                    Name = subtheme.Designation,
                    NameAbbr = subtheme.Designation,
                    ProviderID = p.ID,
                    ThemeID = insertedThemes.Where(it => it.SourceThemeCode == subtheme.ParentCode).First().ID,
                    SourceThemeCode = subtheme.Code
                };

                sub.ID = themesDAO.AddSubTheme(sub);
                insertedSubThemes.Add(sub);
            }

            return insertedSubThemes;
        }
Exemplo n.º 4
0
 public void ThemesDAOConstructorTest()
 {
     ThemesDAO target = new ThemesDAO(connnetion);
     Assert.AreNotEqual(target, null);
 }