Featured post
.net - How to write NUNit test cases when data is read from some database? -
i want test functionality includes call web service data database. methods operate on data.
now want write nunit test cases methods. how can assert results or values when cannot know (at time of writing cases) data fetched @ run time?
an excellent way of doing inserting data (do in negative index range (assuming negatives not in use production data)) run tests dataset, , roll transaction once done.
another option test datalayer better down road, make wrapping interface database layer. can mock interface when running tests need it.
normally might have idatareader object , call idatareader.getmedata , return result set db. in case mock (i use rhino mocks) , tell return set of test data when getmedata called. p.s. don't forget use dependency injection pass in mock database access object.
- Get link
- X
- Other Apps
Comments
Post a Comment