コード例 #1
0
        public void throw_error_if_create_convention_with_not_same_societe()
        {
            var sessionId             = Guid.NewGuid();
            var notificationManagerId = Guid.NewGuid();
            var seat1Id = Guid.NewGuid();
            var seat2Id = Guid.NewGuid();

            var eventStore = new FakeEventStore();

            eventStore.Save(new SeatCreated(seat1Id, 1, sessionId, Guid.NewGuid(), Guid.NewGuid()));
            eventStore.Save(new SeatCreated(seat2Id, 1, sessionId, Guid.NewGuid(), Guid.NewGuid()));
            eventStore.Save(new SeatValided(seat1Id, 2));
            eventStore.Save(new SeatValided(seat2Id, 2));
            eventStore.Save(new NotificationManagerCreated(notificationManagerId, 1, sessionId));

            var queries = new FakeNotificationQueries();

            queries.AddNotificationManager(sessionId, notificationManagerId);

            var    createConvention = new CreateAgreement(new EventBus(new EventDispatcher(), eventStore), new FakeAgreementQueries(), queries);
            Action action           = () => createConvention.Execute(Guid.NewGuid(), new List <Guid>()
            {
                seat1Id, seat2Id
            }, AgreementType.Free);

            action.ShouldThrow <AgreementCompanyException>();
        }
コード例 #2
0
        public void release_session_seat_on_releaseSeat_command()
        {
            var sessionId            = Guid.NewGuid();
            var seatId               = Guid.NewGuid();
            var notificatioManagerId = Guid.NewGuid();
            var studentId            = Guid.NewGuid();

            var fakeStorage = new FakeEventStore();

            fakeStorage.Save(new SessionPlanned(sessionId, 1, Guid.NewGuid(), new DateTime(2018, 1, 9), 1, 5, null, null));
            fakeStorage.Save(new NotificationManagerCreated(notificatioManagerId, 1, sessionId));
            fakeStorage.Save(new SessionSeatBooked(sessionId, 2, Guid.NewGuid()));
            fakeStorage.Save(new SeatCreated(seatId, 3, sessionId, studentId, Guid.NewGuid()));

            var notifQueries = new FakeNotificationQueries();

            notifQueries.AddNotificationManager(sessionId, notificatioManagerId);

            var bus = new EventBus(new EventDispatcher(), fakeStorage);

            new ReleaseSeat(bus, notifQueries).Execute(sessionId, seatId, "essai");

            fakeStorage.GetEvents(sessionId).Should().Contain(new SessionSeatReleased(sessionId, 1, studentId));
            fakeStorage.GetEvents(seatId).Should().Contain(new SeatCanceled(seatId, 1, "essai"));
        }