Possibly save 1 hour of your time: There will be times you want to write some integration unit tests that hit the database to test performance.
One easy way to impose the maximum time in milliseconds on the unit test is using the MaxTime property available on NUnit and can be done as follows:
[Test, MaxTime(2000)] public void YourMethod()
Tip: You might also want to do an initial call to your database in OneTimeSetup to simulate first request will take longer time.
[OneTimeSetUp] public void OneTimeSetUp() { // do a call to database to simulate that first request will take longer time }
Advertisements