示例#1
0
        public void Given_Invalid_EvenStream_When_Build_Then_Throws()
        {
            var id = MeetupId.From(Guid.NewGuid());

            Assert.Throws <MeetupDomainException>(() =>
                                                  MeetupAggregate.Build(
                                                      id,
                                                      new Events.MeetupCreated(id, "EventSourcing with Marten"),
                                                      new Events.MeetupNumberOfSeatsUpdated(id, 10),
                                                      new Events.MeetupLocationUpdated(id, "Barcelona"),
                                                      new Events.MeetupPublished(id),
                                                      new Events.MeetupTimeUpdated(id, DateTime.UtcNow, DateTime.UtcNow.AddHours(2))
                                                      ));
        }
示例#2
0
        public void Given_ValidEvents_When_Build_Then_Built()
        {
            var id     = MeetupId.From(Guid.NewGuid());
            var meetup = MeetupAggregate.Build(
                id,
                new Events.MeetupCreated(id, "EventSourcing with Marten"),
                new Events.MeetupNumberOfSeatsUpdated(id, 10),
                new Events.MeetupLocationUpdated(id, "Barcelona"),
                new Events.MeetupTimeUpdated(id, DateTime.UtcNow, DateTime.UtcNow.AddHours(2)),
                new Events.MeetupPublished(id)
                );

            Assert.Equal(id, meetup.Id);
        }