public void RollbackCollectionReference_LeavesNewCollectionAloneIfAlreadyReassociatedWithOther() { var originalCollection = RegisterAssociatedOriginalCollection(); var newCollection = new OrderCollection(); _associatedCollectionDataStrategyFactoryMock.Stub(stub => stub.CreateDataStrategyForEndPoint(_endPointID)).Return(_associatedDataStrategyStub); _manager.AssociateCollectionWithEndPoint(newCollection); Assert.That(DomainObjectCollectionDataTestHelper.GetDataStrategy(newCollection), Is.SameAs(_associatedDataStrategyStub)); DomainObjectCollectionDataTestHelper.CheckStandAloneCollectionStrategy(originalCollection, typeof(Order)); // Simulate that newCollection has already been re-associated by another rollback operation. // The Rollback operation must leave this other strategy alone. var otherStrategy = new DomainObjectCollectionData(); DomainObjectCollectionDataTestHelper.SetDataStrategy(newCollection, otherStrategy); _manager.RollbackCollectionReference(); Assert.That(DomainObjectCollectionDataTestHelper.GetDataStrategy(originalCollection), Is.SameAs(_associatedDataStrategyStub)); Assert.That(DomainObjectCollectionDataTestHelper.GetDataStrategy(newCollection), Is.SameAs(otherStrategy)); }