コード例 #1
0
        public void ListSchemaTableNamesTest()
        {
            using (var dbInfo = new DbInfo(_connString))
            {
                var tables = dbInfo.ListSchemaTableNames();

                // !!enumerate before dbInfo Dispose (inside using):

                var any = false;
                foreach (var table in tables)
                {
                    any = true;
                    TestContext.WriteLine($"{table.Item1}.{table.Item2}");
                }

                Assert.IsTrue(any);
            }
        }
コード例 #2
0
        public void ReadAllFks()
        {
            using (var dbInfo = new DbInfo(_connString))
            {
                var tables = dbInfo.ListSchemaTableNames().Select(st => $"{st.Item1}.{st.Item2}").ToList();
                //var tables = dbInfo.ListTableNames().ToDictionary();

                var any = false;
                foreach (var fk in dbInfo.ReadAllFKs())
                {
                    any = true;
                    Assert.IsTrue(tables.Any(t => t == fk.Item1));
                    Assert.IsTrue(tables.Any(t => t == fk.Item2));
                    TestContext.WriteLine($"{fk}");
                }

                Assert.IsTrue(any);
            }
        }
コード例 #3
0
        public void ReadAllTablesFks()
        {
            var any = false;

            using (var dbInfo = new DbInfo(_connString))
            {
                foreach (var table in dbInfo.ListSchemaTableNames().ToList())
                {
                    TestContext.WriteLine($"{table}");

                    foreach (var fk in dbInfo.ReadTableFks(schema: table.Item1, tableName: table.Item2))
                    {
                        any = true;
                        TestContext.WriteLine($"\t - {fk}");
                    }
                }
            }
            Assert.IsTrue(any);
        }