Ejemplo n.º 1
0
        public async Task GIVEN_changed_aggregate_root_WHEN_attempting_to_save_THEN_saves_aggregate_root(string serializedAggregateRootId)
        {
            // Arrange
            var repository = new TestRepository(_mockFactory.Object, _mockEventStore.Object);

            var aggregateRootId = new TestAggregateRootId(serializedAggregateRootId);
            var aggregateRoot   = new TestAggregateRoot(aggregateRootId);

            aggregateRoot.ExecuteBehavior();

            // Act
            await repository.SaveAsync(aggregateRoot);

            // Assert
            _mockEventStore.Verify(m => m.SaveAsync(It.IsAny <IReadOnlyCollection <Event> >(), It.IsAny <string>(), It.IsAny <CancellationToken>()), Times.Once());
        }