示例#1
0
        public void Aggregate_EventBased_create_an_empty()
        {
            var factory = new EventBasedAggregateFactory();
            var agg     = factory.Create(new AddEntityCommand("", ""));

            Assert.True(agg.IsValid);
        }
示例#2
0
        public void Aggregate_EventBased_create_a_valid()
        {
            var fixture = new Fixture()
                          .Customize(new AutoNSubstituteCustomization {
                ConfigureMembers = true
            });

            fixture.Register <Name>(() => Name.From(fixture.Create <String>()));
            fixture.Register <Email>(() => Email.From("*****@*****.**"));

            var addEntity = fixture.Create <AddEntityCommand>();

            var factory = new EventBasedAggregateFactory();
            var agg     = factory.Create(addEntity);

            Assert.Equal(nameof(EventStreamBusinessEntityAggregateRoot), agg.GetChange().Name.Value);
            Assert.True(agg.IsValid);
        }
示例#3
0
        public void Aggregate_EventBased_valid_Entity_create()
        {
            var fixture = new Fixture()
                          .Customize(new AutoNSubstituteCustomization {
                ConfigureMembers = true
            });

            fixture.Register <string>(() => "*****@*****.**");

            var name  = fixture.Create <string>();
            var email = fixture.Create <string>();

            var factory = new EventBasedAggregateFactory();
            var agg     = factory.Create(new AddEntityCommand(name, email));

            var change = agg.GetChange();

            Assert.True(agg.IsValid);
            Assert.True(change.IsValid);
            Assert.Equal(1, change.Events.Count);
        }