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>();
        }
        public void throw_error_if_create_convention_has_duplicate_()
        {
            var    placeId          = Guid.NewGuid();
            var    createConvention = new CreateAgreement(new EventBus(new EventDispatcher(), new FakeEventStore()), new FakeAgreementQueries(), new FakeNotificationQueries());
            Action action           = () => createConvention.Execute(Guid.NewGuid(), new List <Guid>()
            {
                placeId, placeId
            }, AgreementType.Free);

            action.ShouldThrow <ArgumentException>();
        }
示例#3
0
 private int Seed(CreateAgreement command)
 {
     _createAgreementHandler.Handle(command);
     return(command.CreatedAgreementId);
 }
 private int Seed(CreateAgreement command)
 {
     _createAgreementHandler.Handle(command);
     return command.CreatedAgreementId;
 }