Wednesday 15 August 2012

How to deal with "HelperDb.ExecuteSql(@"..SomeQuery.sql")" in unit testing? C# .NET -



How to deal with "HelperDb.ExecuteSql(@"..SomeQuery.sql")" in unit testing? C# .NET -

i'm new unit testing, , know test depending upon external resource (like file or database) not unit test, it's integration test instead.

please consider next code snippet:

[testclass] public class mytestclass { [classinitialize] public static void init(testcontext context) { if (system.io.file.exists("../database_scripts/test_scripts/some_query.sql")) { helperdb.executesql("../database_scripts/test_scripts/some_query.sql"); } } ... }

i don't have database installed on server , don't want install it, , wanna test using rhinomocks. how can perform test? help or comments warmely welcome :)

c# unit-testing dependency-injection

No comments:

Post a Comment