public override IASTNode VisitTruncateTable(SqlServerCommandParser.TruncateTableContext context) { TruncateCommand result = new TruncateCommand(); result.Tables.Add((SimpleTableSegment)Visit(context.tableName())); return(result); }
public void Execute_TruncateTemporaryTable_TableIsEmpty() { //Create table CreateTemporaryTable("Temporary", ConnectionStringReader.GetLocalSqlClient()); //Mock the commandXml var info = Mock.Of <IResetCommand>( command => command.ConnectionString == ConnectionStringReader.GetLocalSqlClient() && command.TableName == "Temporary" ); //Apply the test var cmd = new TruncateCommand(info); cmd.Execute(); //Execute Query on temporary table to knwo the new count of elements var after = CountElementsInTable("Temporary", ConnectionStringReader.GetLocalSqlClient()); Assert.That(after, Is.EqualTo(0)); }