unit testing - Basic NMock database examples for CRUD application -
I'm looking for some basic examples of using NMock2 to duplicate database calls for CRM applications.
"post-text" itemprop = "text">
setup:
code> [setup ] Public zero setup () {vocal = new joke (); Mokdibeiler = _mocks.NewMock & lt; IDBLayer & gt; (); // Dependence inject anyway = new SUT (_mockDBLayer); }
Test:
[test] Public Zero testMethodName_TestCase () {var dbRetrunValue = // Whatever is expected. Once. On (mockDBLayer) Method ("dbMethod") will (Return.Value (dbRetrunValue)). // Exercise var real = sut.methodName (); // Corruption ...}
Verification if you want it
[Tyrund] Public Zero Tyrund () {mocks.VerifyAllExpectationsHaveBeenMet (); }
I like though:
Comments
Post a Comment