Exemple #1
0
        public void DescribeSHPSchema()
        {
            IConnectionManager connMgr = FdoFeatureAccessManager.GetConnectionManager();
            FdoIConnection     conn    = connMgr.CreateConnection("OSGeo.SHP");

            conn.ConnectionString = "DefaultFileLocation=" + TestDataStore.SHP;
            Assert.Equal(FdoConnectionState.FdoConnectionState_Open, conn.Open());

            FdoIDescribeSchema desc = conn.CreateCommand((int)FdoCommandType.FdoCommandType_DescribeSchema) as FdoIDescribeSchema;

            Assert.NotNull(desc);
            FdoFeatureSchemaCollection schemas = desc.Execute();

            Assert.Equal(1, schemas.Count);

            FdoFeatureSchema   schema  = schemas.GetItem(0);
            FdoClassCollection classes = schema.GetClasses();

            Assert.Equal(1, classes.Count);

            FdoClassDefinition clsDef = classes.GetItem(0);

            VerifyClass(clsDef);

            //Re-test with sugar
            clsDef = schemas.GetClassDefinition(schema.Name, "World_Countries");
            Assert.NotNull(clsDef);
            VerifyClass(clsDef);
            clsDef = schemas.GetClassDefinition(null, "World_Countries");
            Assert.NotNull(clsDef);
            VerifyClass(clsDef);
            Assert.Throws <ManagedFdoException>(() => schemas.GetClassDefinition(null, "WorldCountries"));
            Assert.Throws <ManagedFdoException>(() => schemas.GetClassDefinition("BogusSchema", "World_Countries"));
        }
        public void TestSQLite()
        {
            IConnectionManager connMgr = FdoFeatureAccessManager.GetConnectionManager();
            FdoIConnection     conn    = connMgr.CreateConnection("OSGeo.SQLite");

            conn.ConnectionString = "File=" + TestDataStore.SQLITE;
            Assert.Equal(FdoConnectionState.FdoConnectionState_Open, conn.Open());
            conn.Close();

            conn.ConnectionString = "File=../IDontExist.sqlite";
            Assert.Throws <ManagedFdoException>(() =>
            {
                FdoConnectionState state = conn.Open();
            });
        }
        public void TestSQLiteSpatialContext()
        {
            IConnectionManager connMgr = FdoFeatureAccessManager.GetConnectionManager();
            FdoIConnection     conn    = connMgr.CreateConnection("OSGeo.SQLite");

            conn.ConnectionString = "File=" + TestDataStore.SQLITE;
            Assert.Equal(FdoConnectionState.FdoConnectionState_Open, conn.Open());
            try
            {
                DoGetSpatialContexts(conn);
            }
            finally
            {
                conn.Close();
            }
        }
Exemple #4
0
        public void TestSHPSpatialExtents()
        {
            IConnectionManager connMgr = FdoFeatureAccessManager.GetConnectionManager();
            FdoIConnection     conn    = connMgr.CreateConnection("OSGeo.SHP");

            conn.ConnectionString = "DefaultFileLocation=" + TestDataStore.SHP;
            Assert.Equal(FdoConnectionState.FdoConnectionState_Open, conn.Open());
            try
            {
                DoSpatialExtents(conn);
                DoFilteredSpatialExtents(conn);
            }
            finally
            {
                conn.Close();
            }
        }
Exemple #5
0
        public void TestSDFDistinct()
        {
            IConnectionManager connMgr = FdoFeatureAccessManager.GetConnectionManager();
            FdoIConnection     conn    = connMgr.CreateConnection("OSGeo.SDF");

            conn.ConnectionString = "File=" + TestDataStore.SDF;
            Assert.Equal(FdoConnectionState.FdoConnectionState_Open, conn.Open());
            try
            {
                DoDistinct(conn);
                DoFilteredDistinct(conn);
            }
            finally
            {
                conn.Close();
            }
        }
Exemple #6
0
        public void TestSHPUpdate()
        {
            IConnectionManager connMgr = FdoFeatureAccessManager.GetConnectionManager();
            FdoIConnection     conn    = connMgr.CreateConnection("OSGeo.SHP");

            conn.ConnectionString = "DefaultFileLocation=" + SHP;
            Assert.Equal(FdoConnectionState.FdoConnectionState_Open, conn.Open());

            try
            {
                DoUpdate(conn);
            }
            finally
            {
                conn.Close();
            }
        }
Exemple #7
0
        public void TestSQLiteCapabilities()
        {
            Log("\n====== Testing SQLite Capabilities =======\n");
            IConnectionManager connMgr = FdoFeatureAccessManager.GetConnectionManager();
            FdoIConnection     conn    = connMgr.CreateConnection("OSGeo.SQLite");

            conn.ConnectionString = "File=" + TestDataStore.SQLITE;
            Assert.Equal(FdoConnectionState.FdoConnectionState_Open, conn.Open());
            ProcessCommandCapabilities(conn);
            ProcessConnectionCapabilities(conn);
            ProcessExpressionCapabilities(conn);
            ProcessFilterCapabilities(conn);
            ProcessGeometryCapabilities(conn);
            ProcessRasterCapabilities(conn);
            ProcessSchemaCapabilities(conn);
            ProcessTopologyCapabilities(conn);
        }
Exemple #8
0
        public void TestSQLiteSelectFiltered()
        {
            IConnectionManager connMgr = FdoFeatureAccessManager.GetConnectionManager();
            FdoIConnection     conn    = connMgr.CreateConnection("OSGeo.SQLite");

            conn.ConnectionString = "File=" + TestDataStore.SQLITE;
            Assert.Equal(FdoConnectionState.FdoConnectionState_Open, conn.Open());

            try
            {
                FdoISelect selectCmd = conn.CreateCommand((int)FdoCommandType.FdoCommandType_Select) as FdoISelect;
                Assert.NotNull(selectCmd);
                TestFilteredSelectCommand(selectCmd);
            }
            finally
            {
                conn.Close();
            }
        }
        public void TestSHP()
        {
            IConnectionManager connMgr = FdoFeatureAccessManager.GetConnectionManager();
            FdoIConnection     conn    = connMgr.CreateConnection("OSGeo.SHP");

            conn.ConnectionString = "DefaultFileLocation=" + TestDataStore.SHP;
            Assert.Equal(FdoConnectionState.FdoConnectionState_Open, conn.Open());
            conn.Close();

            conn.ConnectionString = "DefaultFileLocation=" + TestDataStore.SHP_DIR;
            Assert.Equal(FdoConnectionState.FdoConnectionState_Open, conn.Open());
            conn.Close();

            conn.ConnectionString = "File=../IDontExist.shp";
            Assert.Throws <ManagedFdoException>(() =>
            {
                FdoConnectionState state = conn.Open();
            });
        }