chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
Our project want to do interface development first before database design. How can we get benefits from typemock in this situation please? Could anybody give us some clues about database mocking please? (except for sqlconnection mock, we found it in forum). Any cue would be appreciated!!!
asked by kyue (4.6k points)

1 Answer

0 votes
Our project want to do interface development first before database design. How can we get benefits from typemock in this situation please?


Hi,
This question really depends on the actual implementation. You can start by defining interfaces and starting to mock them (using any mocking framework). This can work quite well, although somewhere along the line you might want to add a logging system (for example). Now you will have a number of architectural choices.
Example:
1. Use an Interface and pass it to each method-
This will be easy to mock but requires passing an ILog to each class.
2. Use a factory Logger.GetLogger() that returns an ILog and thus we don't need to send ILog
This will be easier to mock (if you have a Logger.SetLogger(mockLogger), but you are now maintaining a complex logging framework, the tests will also look strange as we are setting up something that will take time to understand
3. Use a static log function - Logger.Log()
This will need TypeMock.

So if you don't want the testing framework to impair your architectural judgement, you should choose a framework that supports any architecture.
answered by richard (3.9k points)
...