public void GetObjectReference_KnownObject_Invalid_Works() { _invalidDomainObjectManagerMock.Expect(mock => mock.IsInvalid(_objectIDWithCreatorMock)).Return(true); _invalidDomainObjectManagerMock.Expect(mock => mock.GetInvalidObjectReference(_objectIDWithCreatorMock)).Return(_domainObject1); var result = _agent.GetObjectReference(_objectIDWithCreatorMock); _invalidDomainObjectManagerMock.VerifyAllExpectations(); _domainObjectCreatorMock.AssertWasNotCalled( mock => mock.CreateObjectReference(Arg <IObjectInitializationContext> .Is.Anything, Arg <ClientTransaction> .Is.Anything)); Assert.That(result, Is.SameAs(_domainObject1)); }
public void Perform_InvalidatesAndDiscardsNewDataContainers() { _dataContainerMap.Register(_newDataContainer); _endPointManagerMock.Stub(mock => mock.Reset()); _invalidDomainObjectManagerMock.Expect(mock => mock.MarkInvalid(_newDataContainer.DomainObject)).Return(true); _invalidDomainObjectManagerMock.Replay(); _unloadCommand.Perform(); _invalidDomainObjectManagerMock.VerifyAllExpectations(); Assert.That(_newDataContainer.IsDiscarded, Is.True); }
public void GetLoadedObject_Invalid() { var invalidObjectReference = DomainObjectMother.CreateFakeObject <Order> (DomainObjectIDs.Order1); _invalidDomainObjectManagerMock .Expect(mock => mock.IsInvalid(DomainObjectIDs.Order1)) .Return(true); _invalidDomainObjectManagerMock .Expect(mock => mock.GetInvalidObjectReference(DomainObjectIDs.Order1)) .Return(invalidObjectReference); _invalidDomainObjectManagerMock.Replay(); _loadedDataContainerProviderMock.Replay(); var loadedObject = _dataProvider.GetLoadedObject(DomainObjectIDs.Order1); _loadedDataContainerProviderMock.AssertWasNotCalled(mock => mock.GetDataContainerWithoutLoading(Arg <ObjectID> .Is.Anything)); _invalidDomainObjectManagerMock.VerifyAllExpectations(); Assert.That( loadedObject, Is.TypeOf <InvalidLoadedObjectData>().With.Property((InvalidLoadedObjectData obj) => obj.InvalidObjectReference).SameAs(invalidObjectReference)); }