コード例 #1
0
        public void DuplicateOperationExceptionIsThrowsIfSourceAlreadyApplied()
        {
            // Arrange
            var pingEvent = ToDomainEvent(new PingEvent(PingId.New));

            ArrangeWorkingEventStore();
            ArrangeCommandHandlerExists(new PingCommandHandler());
            _testAggregate.ApplyEvents(new [] { pingEvent });

            // Act + Assert
            Assert.Throws <DuplicateOperationException>(async() => await Sut.PublishAsync(new PingCommand(TestId.New, pingEvent.Metadata.SourceId, PingId.New)).ConfigureAwait(false));
        }