protected void CheckTouching (Action modification, TestDomainBase foreignKeyObject, string simpleForeignKeyPropertyName,
                                params RelationEndPointID[] endPointsInvolved)
    {
      // Ensure all end points are loaded into the RelationEndPointManager before trying to check them
      foreach (RelationEndPointID id in endPointsInvolved)
      {
        TestableClientTransaction.DataManager.GetRelationEndPointWithLazyLoad (id);
      }

      if (foreignKeyObject != null)
      {
        Assert.IsFalse (
            foreignKeyObject.Properties[foreignKeyObject.GetPublicDomainObjectType(), simpleForeignKeyPropertyName].HasBeenTouched,
            "ObjectID before modification");
      }

      foreach (RelationEndPointID id in endPointsInvolved)
        Assert.IsFalse (TestableClientTransaction.DataManager.GetRelationEndPointWithoutLoading (id).HasBeenTouched, id + " before modification");

      modification ();

      if (foreignKeyObject != null)
      {
        Assert.IsTrue (
            foreignKeyObject.Properties[foreignKeyObject.GetPublicDomainObjectType(), simpleForeignKeyPropertyName].HasBeenTouched,
            "ObjectID after modification");
      }

      foreach (RelationEndPointID id in endPointsInvolved)
        Assert.IsTrue (TestableClientTransaction.DataManager.GetRelationEndPointWithoutLoading (id).HasBeenTouched, id + " after modification");
    }
Пример #2
0
 private void ExpectHandleReference(ICloneStrategy strategyMock, TestDomainBase original, TestDomainBase clone, string propertyName,
                                    ClientTransaction sourceTransaction, ClientTransaction cloneTransaction)
 {
     strategyMock.HandleReference(new PropertyAccessor(), new PropertyAccessor(), null);
     LastCall.Constraints(
         Rhino.Mocks.Constraints.Is.Equal(original.Properties[original.GetPublicDomainObjectType(), propertyName, sourceTransaction]),
         Rhino.Mocks.Constraints.Is.Equal(clone.Properties[clone.GetPublicDomainObjectType(), propertyName, cloneTransaction]),
         Rhino.Mocks.Constraints.Is.Anything());
 }