Exemplo n.º 1
0
        public async Task Consume_EventDoesNotExistPrivate_CreatesExpected()
        {
            var @event = new EventCreatedEvent()
            {
                ClubId      = Guid.NewGuid(),
                EventId     = Guid.NewGuid(),
                EventPrices = new List <EventPrice>()
                {
                    new EventPrice()
                    {
                        ClubSubscriptionId = Guid.NewGuid(),
                        Price = 50,
                    }
                }
            };

            await SendEvent(@event);

            using (var context = _factory.CreateContext())
            {
                Assert.That(context.Events.Count(), Is.EqualTo(1));
                var e = context.Events.Include(e => e.EventPrices)
                        .First();
                Assert.That(e.EventPrices.Count(), Is.EqualTo(1));
                Assert.That(e.PublicPrice, Is.Null);
            }
        }
Exemplo n.º 2
0
 void HandleEventCreated(EventCreatedEvent e)
 {
     lasteventbox.Visible = true;
     lastlabel.Text       = e.TimelineEvent.Name;
     lastlabel.ModifyFg(StateType.Normal, Misc.ToGdkColor(e.TimelineEvent.Color));
     lastevent = e.TimelineEvent;
 }
        public async Task Handle_Success()
        {
            // Arrange
            var notification = new EventCreatedEvent(validEventId);

            // Act
            await policy.Handle(notification, CancellationToken.None);

            // Assert
            A.CallTo(() => telemetryService.TrackEvent(TelemetryEventNames.NewEvent, A <object> ._))
            .MustHaveHappenedOnceExactly();
        }
        public async Task Handle_Success()
        {
            // Arrange
            EventCreatedEvent notification = CreateNotification();

            // Act
            await policy.Handle(notification, CancellationToken.None);

            // Assert
            A.CallTo(() => notificationPublisher.PublishAsync(
                         NotificationType.NewEvent,
                         A <string> ._,
                         A <IEnumerable <Diver> > ._,
                         A <Diver> ._,
                         validEventId,
                         null))
            .MustHaveHappenedOnceExactly();
        }
Exemplo n.º 5
0
        public async Task Consume_EventDoesExist_DoesNotCreateAnotherd()
        {
            var @event = new EventCreatedEvent()
            {
                ClubId      = Guid.NewGuid(),
                EventId     = Guid.NewGuid(),
                PublicPrice = 10,
                EventPrices = new List <EventPrice>()
                {
                    new EventPrice()
                    {
                        ClubSubscriptionId = Guid.NewGuid(),
                        Price = 50,
                    }
                }
            };

            using (var context = _factory.CreateContext())
            {
                context.Events.Add(new Event()
                {
                    EventId     = @event.EventId,
                    ClubId      = @event.ClubId,
                    PublicPrice = 10
                });
                context.SaveChanges();
            }

            await SendEvent(@event);

            using (var context = _factory.CreateContext())
            {
                Assert.That(context.Events.Count(), Is.EqualTo(1));
                var e = context.Events.Include(e => e.EventPrices)
                        .First();
                Assert.That(e.EventPrices.Count(), Is.EqualTo(0));
                Assert.That(e.PublicPrice, Is.EqualTo(10));
            }
        }
 void HandleEventCreated(EventCreatedEvent e)
 {
     codingwidget1.AddPlay ((TimelineEventLongoMatch)e.TimelineEvent);
 }