public void Validate_PublishedMessages() { // Arrange objPublishManagerController = new PublishManagerController(applicationDbContext); IntrimData.SetData(new List <Domain.NotificationQueue> { new Domain.NotificationQueue { Id = 1, ChannelMessage = "facebook" } }); // Act var data = objPublishManagerController.Get(); // Assert Assert.IsNotNull(data); Assert.AreEqual(1, data.Count()); }
public void Post([FromBody] PublishConfiguration publishConfiguration) { foreach (var item in _context.channelOnboard) { MessagePublisher mp = new MessagePublisher(item.sourceName, publishConfiguration.sourceNotificationInterval); var subscriber = _context.subscriberOnboard.Where(s => s.ChannelId == item.Id).FirstOrDefault(); if (subscriber != null) { MessageSubscriber sub1 = new MessageSubscriber(subscriber.SubEmail, subscriber.Category); sub1.Subscribe(mp); mp.Publish(); IntrimData.SetData(mp.GetAllNotification()); //_context.notificationQueue.AddRange(mp.GetAllNotification()); //_context.SaveChanges(); } } }