c# - Writing File in Unit-Test: Single-Unittest working, but not on all -


we have code, helps write data test against json-files.

my code quite straightforward:

internal static void writedatasourcestojson(ienumerable<reportdatasource> datasources, string jsonfilepath) {     lock (_lockobject)     {         string jsonstring = jsonconvert.serializeobject(datasources);          using (var fs = new filestream(jsonfilepath, filemode.openorcreate))         using (var sw = new streamwriter(fs))         {             sw.write(jsonstring);         }     } } 

it works fine, if run single tests, select "run all" on class, seems code gets ignored without warning. thought threading-problem, lock doesnt nor error-message.

is "run all" kindahow handled different running single unit-test?

edit: we're using default unit-testing of microsoft in namespace microsoft.visualstudio.testtools.unittesting


Comments