sql server - C# SMO Database do not log creation -


i have integration test creates database of type microsoft.sqlserver.management.smo.database:

var defaultconnectionconnectionstring = configurationmanager.connectionstrings["defaultconnection"].tostring(); var sqlconnection = new sqlconnection(defaultconnectionconnectionstring); var serverconnection = new serverconnection(sqlconnection);  _server = new server(serverconnection);  _database = new database(_server, _integrationtestingdatabasename);  _database.create(); 

when run integration test via cli nunit, when test finishes, sql creating database dumped console. clutters output , not want see when running integration test. how can stop happening?

this goose chase , cannot reproduced.

i'm guessing there maybe confusion, perhaps 1 of scripts sql print or red-herring that. because executing unit test create sql db via sql management objects not output sql creation script.

enter image description here

even executing directly command line doesn't log sql creation script. here repro:

using nunit.framework; using consoleapplication1; using system.io; using system.diagnostics;  [testfixture] public class unittest1 {         static filestream objstream;      [setup]     public static void setup()     {         objstream = new filestream(appdomain.currentdomain.basedirectory + "\\aaa_output.txt", filemode.openorcreate);         textwritertracelistener objtracelistener = new textwritertracelistener(objstream);         trace.listeners.add(objtracelistener);         trace.writeline("===================================");         trace.writeline("app start:" + datetime.now);         trace.writeline("===================================");     }      [testcase]     public void testmethod1()     {         program.createdb();     }      [teardown]     public static void teardown()     {         trace.flush();         objstream.close();     } } 

results:

enter image description here


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -