public async Task QueueEvent_DeQueue() { // Arrange var compassEvent = new CompassEvent { EventName = "test" }; var queuedEvents = new QueuedEvents() { Events = new List <CompassEvent>() { compassEvent } }; A.CallTo(() => _dataStore.GetQueuedEventsAsync()) .Returns(Task.FromResult(queuedEvents)); // Act await _sut.DeQueueEventAsync(compassEvent); // Assert A.CallTo(() => _dataStore.UpsertAsync(queuedEvents)) .MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => _dataStore.UpsertAsync(A <QueuedEvents> .That.Matches(arg => !arg.Events.Contains(compassEvent)))) .MustHaveHappened(Repeated.Exactly.Once); }
private async Task SendEvent(ServiceSubscription serviceSubscription, CompassEvent compassEvent) { await _sendToEndpointService.SendToEndpointAsync(new List <ServiceSubscription> { serviceSubscription }, compassEvent); await _queueEventService.DeQueueEventAsync(compassEvent); }