Exemple #1
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }