public void GetConfigurationTest()
        {
            ConfigurationDAO target = new ConfigurationDAO(connnetion);

            int indicatorId = 1;
            string geoLevel = "NUTS1";
            Configuration expected = new Configuration
            {
                ID = 1,
                GeoLevel = "NUTS1",
                Shapefile = new Shapefile
                {
                    ID = 4,
                    FileName = "nuts1.shp",
                    Name = "NUTS1",
                    Path = "D:\\Dropbox\\My Dropbox\\Tese\\shapefiles\\sapo\\GIS\\NUTS1",
                    Level = 1
                }
            };

            Configuration actual;
            actual = target.GetConfiguration(indicatorId, geoLevel);

            Assert.AreEqual(expected, actual);
        }
        public void GetConfigurationsTest()
        {
            ConfigurationDAO target = new ConfigurationDAO(connnetion);

            int indicatorId = 1;
            IEnumerable<Configuration> actual;
            actual = target.GetConfigurations(indicatorId);

            Assert.AreEqual(actual.Count(), 5);
            Assert.AreEqual(actual.ElementAt(0).GeoLevel, "NUTS1");
            Assert.AreEqual(actual.ElementAt(1).GeoLevel, "NUTS2");
            Assert.AreEqual(actual.ElementAt(2).GeoLevel, "NUTS3");
            Assert.AreEqual(actual.ElementAt(3).GeoLevel, "Municipalities");
            Assert.AreEqual(actual.ElementAt(4).GeoLevel, "Parishes");
        }
Пример #3
0
        public static void addConfiguration(DbConnection conn, Indicator indicator, string lowestGeoLevel)
        {
            var configurationDAO = new ConfigurationDAO(conn);
            for (int geoLevel = int.Parse(lowestGeoLevel); geoLevel >= 2; --geoLevel)
            {
                GEOLevels level = (GEOLevels)geoLevel;

                Console.WriteLine("... Adding configuration: {0} ....", level.ToString());

                DataStore.Common.Model.Configuration config = new DataStore.Common.Model.Configuration
                {
                    GeoLevel = level.ToString(),
                    Shapefile = new Shapefile
                    {
                        ID = SHAPEFILE_IDS[level]
                    }
                };
                configurationDAO.AddConfiguration(indicator.ID, config);
            }
        }
 public void ConfigurationDAOConstructorTest()
 {
     ConfigurationDAO target = new ConfigurationDAO();
     Assert.AreNotEqual(target, null);
 }
        public void GetShapefileConfigurationURLTest()
        {
            ConfigurationDAO target = new ConfigurationDAO(connnetion);
            int indicatorId = 1;
            string geoLevel = "NUTS1";
            string expected = "D:\\Dropbox\\My Dropbox\\Tese\\shapefiles\\sapo\\GIS\\NUTS1\\nuts1.shp";
            string actual;
            actual = target.GetShapefileConfigurationURL(indicatorId, geoLevel);

            Assert.AreEqual(expected, actual);
        }