public void MainTest()
        {
            SchemaExtractionResult extractionResult;

            using (var connection = driver.CreateConnection()) {
                connection.Open();
                var defaultSchema = driver.ExtractDefaultSchema(connection);
                extractionResult = new SchemaExtractionResult();
                extractionResult.Catalogs.Add(defaultSchema.Catalog);
            }

            Assert.That(extractionResult.IsShared, Is.False);
            Assert.DoesNotThrow(() => { var name = extractionResult.Catalogs.First().Name; });
            Assert.DoesNotThrow(() => { var name = extractionResult.Catalogs.First().DbName; });
            Assert.DoesNotThrow(() => { var name = extractionResult.Catalogs.First().DefaultSchema.Name; });
            Assert.DoesNotThrow(() => { var name = extractionResult.Catalogs.First().DefaultSchema.DbName; });
            Assert.DoesNotThrow(() => { var name = extractionResult.Catalogs.First().DefaultSchema.Tables["Product"].Name; });
            Assert.DoesNotThrow(() => { var name = extractionResult.Catalogs.First().DefaultSchema.Tables["Product"].DbName; });

            extractionResult.MakeShared();

            Assert.That(extractionResult.IsShared, Is.True);
            Assert.Throws <InvalidOperationException>(() => { var name = extractionResult.Catalogs.First().Name; });
            Assert.Throws <InvalidOperationException>(() => { var name = extractionResult.Catalogs.First().DbName; });
            Assert.Throws <InvalidOperationException>(() => { var name = extractionResult.Catalogs.First().DefaultSchema.Name; });
            Assert.Throws <InvalidOperationException>(() => { var name = extractionResult.Catalogs.First().DefaultSchema.DbName; });
            Assert.DoesNotThrow(() => { var name = extractionResult.Catalogs.First().DefaultSchema.Tables["Product"].Name; });
            Assert.DoesNotThrow(() => { var name = extractionResult.Catalogs.First().DefaultSchema.Tables["Product"].DbName; });
        }
Esempio n. 2
0
 private Catalog ExtractCatalog()
 {
     using (var connection = driver.CreateConnection()) {
         connection.Open();
         return(nodeToSchemaMap.Count > 0
   ? driver.ExtractCatalog(connection)
   : driver.ExtractDefaultSchema(connection).Catalog);
     }
 }