public async Task Consume_EventDoesNotExistSomehow_IgnoresEvent() { SetupAnEntireClub(); var e = CreateEvent(); var @event = new TimeslotReservedEvent() { EventId = Guid.NewGuid(), }; await SendEvent(@event); await _publishEndpoint.Received(0).Publish( Arg.Any <EventCreatedEvent>()); }
public async Task Consume_RoomDoesNotExist_PublishFailedEventWithReason() { var @event = new VerifyChangedTimeslotEvent() { EventId = Guid.NewGuid(), RoomIds = new List <Guid>() { Guid.NewGuid() } }; await SendEvent(@event); await _publishEndpoint.Received(1).Publish( Arg.Any <TimeslotReservationFailedEvent>()); }
public async Task Consume_NoLocations_DefaultRoomCreated() { var @event = new ClubCreatedEvent() { ClubId = Guid.NewGuid() }; await SendEvent(@event); using (var context = _factory.CreateContext()) { var club = context.Clubs .Include(club => club.Rooms) .FirstOrDefault(club => club.ClubId == @event.ClubId); Assert.That(club.Rooms.Count, Is.EqualTo(1)); Assert.That(club.Rooms.First().Name, Is.EqualTo("Default")); } await _publishEndpoint.Received(1).Publish(Arg.Any <RoomCreatedEvent>()); }
public async Task Consume_SubscriptionMustExist_DoesNothing() { var @event = new SignUpSubscriptionSuccessEvent() { ClubSubscriptionId = Guid.NewGuid(), UserId = Guid.NewGuid() }; await SendEvent(@event); await _publishEndpoint.Received(0).Publish(Arg.Any <ClubMemberCreatedEvent>()); await _publishEndpoint.Received(0).Publish(Arg.Any <ClubMemberUpdatedEvent>()); }