Пример #1
0
        public static void GivenPublishedMeetup(int withCapacity, Action <AttendeesListProjector, AttendeesListReadModel> when, Action <AttendeesListReadModel> then)
        {
            var projector        = new AttendeesListProjector();
            var readModelUpdated = projector.Project(new AttendeesListReadModel(),
                                                     new Events.MeetupCreated {
                MeetupId = id, Title = title, Location = location
            },
                                                     new Events.NumberOfSeatsUpdated {
                MeetupId = id, NumberOfSeats = withCapacity
            },
                                                     new Events.MeetupPublished {
                MeetupId = id,
            });

            when(projector, readModelUpdated);
            then(readModelUpdated);
        }
Пример #2
0
        public void Test2()
        {
            var fixture  = new Fixture();
            var id       = fixture.Create <Guid>();
            var title    = fixture.Create <string>();
            var location = fixture.Create <string>();
            var seats    = 2;

            var bob   = fixture.Create <Guid>();
            var bill  = fixture.Create <Guid>();
            var carla = fixture.Create <Guid>();

            var projector = new AttendeesListProjector();

            var readModelUpdated = projector.Project(new AttendeesListReadModel(),
                                                     new Events.MeetupCreated {
                MeetupId = id, Title = title, Location = location
            },
                                                     new Events.NumberOfSeatsUpdated {
                MeetupId = id, NumberOfSeats = seats
            },
                                                     new Events.MeetupPublished {
                MeetupId = id,
            },
                                                     new Events.RSVPAccepted {
                MeetupId = id, MemberId = bob
            },
                                                     new Events.RSVPAccepted {
                MeetupId = id, MemberId = carla
            },
                                                     new Events.RSVPAccepted {
                MeetupId = id, MemberId = bill
            },
                                                     new Events.RSVPDeclined {
                MeetupId = id, MemberId = bob
            }
                                                     );

            readModelUpdated.MembersGoing.AssertEqual(carla, bill);
            readModelUpdated.MembersNotGoing.AssertEqual(bob);
            Assert.Empty(readModelUpdated.WaitingList);
        }