public async Task GivenAnExceptionThenTheExceptionIsThrownAsync() { var reconciler = new TestableSynchronousAggregateReconciliationProxy(); _ = await Assert.ThrowsAsync <NotImplementedException>( () => reconciler.GetAllAsync()); }
public async Task GivenAnAggregateThenTheAggregateIsPropagatedAsync() { bool wasInvoked = false; var expected = new SerializableEventCentricAggregateRoot(); var proxy = new TestableSynchronousAggregateReconciliationProxy(save: actual => { wasInvoked = true; Assert.Equal(expected, actual); }); await proxy.SaveAsync(expected); Assert.True(wasInvoked); }
public async Task GivenAReferenceThenTheReferenceIsPropagatedAsync() { bool wasInvoked = false; SerializableEventCentricAggregateRoot[] expected = new[] { new SerializableEventCentricAggregateRoot() }; var proxy = new TestableSynchronousAggregateReconciliationProxy(getAll: () => { wasInvoked = true; return(expected); }); IEnumerable <EventCentricAggregateRoot>?actual = await proxy.GetAllAsync(); Assert.True(wasInvoked); Assert.Equal(expected, actual); }
public async Task GivenAReferenceThenTheReferenceIsPropagatedAsync() { bool wasInvoked = false; var expectedAggregate = new SerializableEventCentricAggregateRoot(); var expectedReference = expectedAggregate.ToReference(); var proxy = new TestableSynchronousAggregateReconciliationProxy(get: actualReference => { wasInvoked = true; Assert.Equal(expectedReference, actualReference); return(expectedAggregate); }); EventCentricAggregateRoot?actualAggregate = await proxy.GetAsync(expectedReference); Assert.True(wasInvoked); Assert.Equal(expectedAggregate, actualAggregate); }