I am new to unit testing and I am trying to run unit test on the server side for a WCF RIA ser开发者_StackOverflowvice. Since the class generated by the wizard looks like this:
MyDomainService : LinqToSqlDomainService<MyDataContext>
I am not sure how to set it up so that I can unit test MyDomainService without having to connect to the database. I know I need to setup a mock but I am not sure where/how. Also is not the autogenerated code that I need to unit test but custom service operations that I have written that need to use the underlying datacontext.
You could try using the repository pattern. There's a downloadable example of how to do this here http://code.msdn.microsoft.com/Repository-Pattern-Demo-fece07ed
精彩评论