예제 #1
0
        public void TestCleanWithSkip()
        {
            seedFKData(GetConnection(), GetDbType());

            DbDataReader reader = SqlScriptRunner.ExecCommandWithDataReader(GetConnection(), "SELECT * FROM Bar;");

            Assert.True(reader.HasRows);
            reader.Close();

            reader = SqlScriptRunner.ExecCommandWithDataReader(GetConnection(), "SELECT * FROM Foo;");
            Assert.True(reader.HasRows);
            reader.Close();

            //clean all except Foo
            CleanDb(new List <string>()
            {
                "Foo"
            });
            reader = SqlScriptRunner.ExecCommandWithDataReader(GetConnection(), "SELECT * FROM Foo;");
            Assert.True(reader.HasRows);
            reader.Close();

            reader = SqlScriptRunner.ExecCommandWithDataReader(GetConnection(), "SELECT * FROM Bar;");
            Assert.False(reader.HasRows);
            reader.Close();
        }
예제 #2
0
        public void TestAllClean()
        {
            seedFKData(GetConnection(), GetDbType());

            DbDataReader reader = SqlScriptRunner.ExecCommandWithDataReader(GetConnection(), "SELECT * FROM Bar;");

            Assert.True(reader.HasRows);
            reader.Close();

            reader = SqlScriptRunner.ExecCommandWithDataReader(GetConnection(), "SELECT * FROM Foo;");
            Assert.True(reader.HasRows);
            reader.Close();

            //clean all
            CleanDb(null);
            reader = SqlScriptRunner.ExecCommandWithDataReader(GetConnection(), "SELECT * FROM Foo;");
            Assert.False(reader.HasRows);
            reader.Close();

            reader = SqlScriptRunner.ExecCommandWithDataReader(GetConnection(), "SELECT * FROM Bar;");
            Assert.False(reader.HasRows);
            reader.Close();
        }