public void Commit_ReadOnly() { _customerEndPoint.Collection.Add(_order3); DomainObjectCollectionDataTestHelper.MakeCollectionReadOnly(_customerEndPoint.Collection); _customerEndPoint.Commit(); Assert.That(_customerEndPoint.Collection, Is.EqualTo(new[] { _order1, _order2, _order3 })); Assert.That(_customerEndPoint.GetCollectionWithOriginalData(), Is.EqualTo(new[] { _order1, _order2, _order3 })); Assert.That(_customerEndPoint.OriginalCollection, Is.SameAs(_customerEndPoint.Collection)); Assert.That(_customerEndPoint.Collection.IsReadOnly, Is.True); }
public void RollbackReadOnlyOppositeDomainObjects() { Customer customer = DomainObjectIDs.Customer1.GetObject <Customer> (); customer.Orders.Add(DomainObjectIDs.Order3.GetObject <Order> ()); DomainObjectCollectionDataTestHelper.MakeCollectionReadOnly(customer.Orders); TestableClientTransaction.Rollback(); Assert.That(customer.GetOriginalRelatedObjects("Remotion.Data.DomainObjects.UnitTests.TestDomain.Customer.Orders").IsReadOnly, Is.True); Assert.That(customer.Orders.IsReadOnly, Is.True); }
public void SetCollection_SourceCollection_IsReadOnly() { DomainObjectCollectionDataTestHelper.MakeCollectionReadOnly(_customerEndPoint.Collection); var newOpposites = new OrderCollection { _order2, _order3 }; var oldOpposites = _customerEndPoint.Collection; Assert.That(oldOpposites.IsReadOnly, Is.True); SetCollectionAndNotify(_customerEndPoint, newOpposites); Assert.That(_customerEndPoint.Collection, Is.SameAs(newOpposites)); Assert.That(_customerEndPoint.OriginalCollection, Is.SameAs(oldOpposites)); }