public void then_stored_notifications_updated_are_found_using_ef() { List <StoredNotificationLong> actual = DbContext.StoredNotifications .Where(x => x.SubscriberId == _subscriberId) .OrderBy(x => x.CreateDateUtc) .ToList(); actual.Should().NotBeEmpty(); actual.Count.Should().Be(_insertedData.Count); for (int i = 0; i < _insertedData.Count; i++) { StoredNotificationLong actualItem = actual[i]; StoredNotification <long> expectedItem = _insertedData[i]; actualItem.Should().BeEquivalentTo(expectedItem); } }
//methods public virtual Task <ProcessingResult> Send(SignalDispatch <TKey> item) { var signal = (StoredNotificationDispatch <TKey>)item; if (signal.ReceiverSubscriberId == null) { throw new NullReferenceException(string.Format(SenderInternalMessages.Common_MissingPropertyValue, nameof(signal.ReceiverSubscriberId), nameof(StoredNotificationDispatch <TKey>))); } var storedNotification = new StoredNotification <TKey> { MessageBody = signal.MessageBody, MessageSubject = signal.MessageSubject, CategoryId = signal.CategoryId, TopicId = signal.TopicId, SubscriberId = signal.ReceiverSubscriberId.Value, CreateDateUtc = DateTime.UtcNow }; _storedNotificationsFlushJob.Insert(storedNotification); return(Task.FromResult(ProcessingResult.Success)); }
//add to flush queue public virtual void Insert(StoredNotification <TKey> item) { _flushQueues[FlushAction.Insert].Queue.Add(item); }