开发者

Unit testing LinqToSqlDomainService

开发者 https://www.devze.com 2023-01-29 03:57 出处:网络
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:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消