コード例 #1
0
        public void Will_Clear_Data_From_Table_With_Foreign_Key()
        {
            tester.DropTable("dbo", "child");
            tester.DropTable("dbo", "parent");
            tester.ExecuteStatementWithoutResult("create table [dbo].[parent]([id] int primary key, [name] varchar(200));");
            tester.ExecuteStatementWithoutResult("create table [dbo].[child]([id] int, [parentid] int not null, [name] varchar(200));");
            tester.ExecuteStatementWithoutResult("alter table [dbo].[child] add constraint [FK_parent_child] foreign key ([parentid]) references [dbo].[parent]([id]);");
            tester.ExecuteStatementWithoutResult("insert into [dbo].[parent]([id],[name]) values (1,'testparent');");


            tester.ClearTable("dbo", "parent");


            Assert.AreEqual(0, tester.RowCount("dbo", "parent"));
        }
コード例 #2
0
        public void Will_Drop_Table_If_Exists()
        {
            DropAndCreateTable(schemaName, tableName);

            tester.DropTable(schemaName, tableName);

            Assert.IsFalse(tester.HasTable(schemaName, tableName));
        }