Example #1
0
        public void Accepting_unit_of_work_stores_and_publishes_the_events()
        {
            var commandId          = Guid.NewGuid();
            var store              = MockRepository.GenerateMock <IEventStore>();
            var bus                = MockRepository.GenerateMock <IEventBus>();
            var domainRepository   = MockRepository.GenerateMock <IDomainRepository>();
            var snapshotStore      = MockRepository.GenerateMock <ISnapshotStore>();
            var snapshottingPolicy = new NoSnapshottingPolicy();

            store.Expect(s => s.Store(null)).IgnoreArguments();
            bus.Expect(b => b.Publish((IEnumerable <IPublishableEvent>)null)).IgnoreArguments();

            var sut = new UnitOfWork(commandId, domainRepository, store, snapshotStore, bus, snapshottingPolicy);

            sut.Accept();

            bus.VerifyAllExpectations();
            store.VerifyAllExpectations();
        }