Example #1
0
        public void GIVEN_unchanged_aggregate_root_WHEN_attempting_to_save_THEN_does_not_throw_any_exception()
        {
            // Arrange
            var repository = new TestRepository(_mockFactory.Object, _mockEventStore.Object);

            var aggregateRoot = new TestAggregateRoot();

            aggregateRoot.LoadFromStream(_events.ToList());

            // Act
            Func <Task> act = async() => await repository.SaveAsync(aggregateRoot);

            // Assert
            act.Should()
            .NotThrow <Exception>();

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