Unit testing WCF-RIA Services

168 Views Asked by At

When data from a Get operation on my DomainService is sent to the DomainContext in my silverlight application, some rows end up not being sent while others are sent. I check this by setting a breakpoint in the DomainService and a breakpoint in the DomainContext load operation callback. How can I create a unit test to check this?

E.g. Set up some in-memory data for the DomainService and check if the silverlight DomainContext receives this data?

1

There are 1 best solutions below

0
On

This is usually caused by a primary key that isn't unique. When RIA Services sends rows to the client it filters the results by the primary key to make sure there are no duplicates. If you have two rows with different data but the same primary key only one of those rows will make it to the client.

There is a blog series by Kyle McClellan on how to unit test RIA Services: http://blogs.msdn.com/b/kylemc/archive/2011/08/18/unit-testing-a-wcf-ria-domainservice-part-1-the-idomainservicefactory.aspx which may be helpful.