예제 #1
0
        public void TestNullDataSet()
        {
            DataSet ds = null;
            SqlDataSchemaAdapter adapter = new SqlDataSchemaAdapter(Host);

            Assert.Throws <ArgumentException>(() => adapter.GetSchemaScript(ds));
        }
예제 #2
0
        public void TestNoColumns1()
        {
            DataSet ds = new DataSet("TestNoColumns");

            ds.Tables.Add("empty_table");

            SqlDataSchemaAdapter adapter = new SqlDataSchemaAdapter(Host);

            Assert.Throws <ArgumentException>(() => adapter.GetSchemaScript(ds));
        }
예제 #3
0
        public void TestNoColumns2()
        {
            string name = "TestNoColumns2";
            string file = Path.GetFullPath(Path.ChangeExtension(name, ".xsd"));

            try
            {
                DataSet ds = new DataSet(name);
                ds.Tables.Add("empty_table_1");
                ds.Tables.Add("empty_table_2");
                ds.WriteXmlSchema(file);
                ds.Dispose();
                ds = new DataSet();
                ds.ReadXmlSchema(file);

                SqlDataSchemaAdapter adapter = new SqlDataSchemaAdapter(Host);
                Assert.Throws <ArgumentException>(() => adapter.GetSchemaScript(ds));
            }
            finally
            {
                File.Delete(file);
            }
        }