コード例 #1
0
        public void OnTransactionDiscard()
        {
            _parentHierarchyManagerStrictMock.Expect(mock => mock.RemoveSubTransaction());

            _manager.OnTransactionDiscard();

            _parentHierarchyManagerStrictMock.VerifyAllExpectations();
        }
        public void OnBeforeObjectRegistration_ExceptionInInnerListener()
        {
            var loadedObjectIDs = Array.AsReadOnly(new[] { DomainObjectIDs.Order1, DomainObjectIDs.Order3 });

            var exception = new Exception("Test");

            using (_mockRepository.Ordered())
            {
                _hierarchyManagerMock.Expect(mock => mock.OnBeforeObjectRegistration(loadedObjectIDs)).Throw(exception);
            }
            _mockRepository.ReplayAll();

            Assert.That(() => _decorator.OnBeforeObjectRegistration(loadedObjectIDs), Throws.Exception.SameAs(exception));

            _eventSinkWithMock.AssertWasNotCalled(mock => mock.RaiseObjectsLoadingEvent(Arg <ReadOnlyCollection <ObjectID> > .Is.Anything));
            _hierarchyManagerMock.VerifyAllExpectations();
        }