开发者

Unit Testing RIA Services

开发者 https://www.devze.com 2022-12-11 06:54 出处:网络
I have a domain services class that runs on the server in a silverlight application. I.e. the class is defined like this,

I have a domain services class that runs on the server in a silverlight application. I.e. the class is defined like this,

public class UpgradeToolDomainService : DomainService
{
...
}

I am using RIA services which means that on the client it generates code which looks like this,

public sealed partial class UpgradeToolDomainContext : DomainContext
{
...
}

The problem with that is I would like to mock the UpgradeToolDomainContext using Rhino mocks when unit testing my client side cod开发者_JS百科e, but the class is sealed and Rhino mocks doesn't support mocking sealed classes.

What do you think?? I.e. is it possible to change the generated code to not be sealed? Or any other obvious solution?


For the moment what I have done is create a partial class UpgradeToolDomainContext. I have made this class implement an interface. I am using this interface to create my mocks with.

Any better suggestions are welcome.

0

精彩评论

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