Integration test:
UERDomainService uerDomainService;
[TestInitialize]
public void Setup()
{
uerDomainService = new UERDomainService();
}
[TestMethod]
public void GetUsersWithRoles_GivenRoleID1003_ShouldNotReturnMateerAsSoftDeleted()
{
// blah
Assert.AreEqual(0, thing.Count());
// blah
uerDomainService.DeleteRoleMembership(rm);
}
then in DeleteRoleMembership(rm) which is a RIA Services code genned method:
public void DeleteRoleMembership(RoleMembership roleMembership)
{
if ((roleMembership.EntityState != EntityState.Detached))
{
this.ObjectContext.ObjectStateManager.ChangeObjectState(roleMembership, EntityState.Deleted);
}
else
{
this.ObjectContext.RoleMemberships.Attach(roleMembership);
this.ObjectContext.RoleMemberships.DeleteObject(roleMembership);
}
// added to get tests working
ObjectContext.SaveChanges();
}
Why do I have to put in this in to get my tests to work?
Yet don't need it for my Silverlight app to work. I know its something to do with the saving pipeline for RIA. The method uerDomainService.Submit needs a ChangeSet.
Question: How do I kick off the SubmitChanges pipeline from my test?