コード例 #1
0
            public void DefaultMappingStrategyUsedWhenNoExplicitStrategyDefined()
            {
                typeLocator.Setup(mock => mock.GetTypes(It.IsAny <Func <Type, Boolean> >())).Returns(new[] { typeof(ImplicitStrategyAggregate) });

                var updater   = new AggregateUpdater(typeLocator.Object);
                var aggregate = new ImplicitStrategyAggregate();
                var e         = new FakeEvent();

                updater.Apply(e, aggregate);

                Assert.Same(e, aggregate.AppliedEvents.Single());
            }
コード例 #2
0
            public void AggregateMustHaveAtLeastOneKnownApplyMethod()
            {
                typeLocator.Setup(mock => mock.GetTypes(It.IsAny <Func <Type, Boolean> >())).Returns(new Type[0]);

                var updater   = new AggregateUpdater(typeLocator.Object);
                var aggregate = new ImplicitStrategyAggregate();
                var e         = new FakeEvent();

                var ex = Assert.Throws <MappingException>(() => updater.Apply(e, aggregate));

                Assert.Equal(Exceptions.AggregateTypeUndiscovered.FormatWith(typeof(ImplicitStrategyAggregate)), ex.Message);
            }
コード例 #3
0
            public void AggregateMustHaveAtLeastOneKnownApplyMethod()
            {
                typeLocator.Setup(mock => mock.GetTypes(It.IsAny<Func<Type, Boolean>>())).Returns(new Type[0]);

                var updater = new AggregateUpdater(typeLocator.Object);
                var aggregate = new ImplicitStrategyAggregate();
                var e = new FakeEvent();

                var ex = Assert.Throws<MappingException>(() => updater.Apply(e, aggregate));

                Assert.Equal(Exceptions.AggregateTypeUndiscovered.FormatWith(typeof(ImplicitStrategyAggregate)), ex.Message);
            }
コード例 #4
0
            public void DefaultMappingStrategyUsedWhenNoExplicitStrategyDefined()
            {
                typeLocator.Setup(mock => mock.GetTypes(It.IsAny<Func<Type, Boolean>>())).Returns(new[] { typeof(ImplicitStrategyAggregate) });

                var updater = new AggregateUpdater(typeLocator.Object);
                var aggregate = new ImplicitStrategyAggregate();
                var e = new FakeEvent();

                updater.Apply(e, aggregate);

                Assert.Same(e, aggregate.AppliedEvents.Single());
            }