public void QueueCancellationTokenTest() { //Arrange var token = new CancellationTokenSource(); var queueProcess = new QueueProcess(0, null); token.Cancel(); //Act & Assert CustomAssert.IsThrown<OperationCanceledException>(() => queueProcess.ProcessMethod(null, token.Token)); }
public void QueueCancellationTokenTest() { //Arrange var token = new CancellationTokenSource(); var queueProcess = new QueueProcess(0, null); token.Cancel(); //Act & Assert CustomAssert.IsThrown <OperationCanceledException>(() => queueProcess.ProcessMethod(null, token.Token)); }
public void EmptyQueueTest() { //Arrange var queueVideoRepository = new Mock<IQueueVideoRepository>(); var queueProcess = new QueueProcess(0, queueVideoRepository.Object); queueVideoRepository.Setup(m => m.GetMessage()).Returns((VideoMessage) null); //Act var queueInfo = queueProcess.ProcessMethod(null, new CancellationToken()); //Asert Assert.AreEqual(null, queueInfo.VideoMessage); }
public void EmptyQueueTest() { //Arrange var queueVideoRepository = new Mock <IQueueVideoRepository>(); var queueProcess = new QueueProcess(0, queueVideoRepository.Object); queueVideoRepository.Setup(m => m.GetMessage()).Returns((VideoMessage)null); //Act var queueInfo = queueProcess.ProcessMethod(null, new CancellationToken()); //Asert Assert.AreEqual(null, queueInfo.VideoMessage); }
public void QueuedSuccessfulTest() { //Arrange var queueMsg = new VideoMessage(); var queueVideoRepository = new Mock<IQueueVideoRepository>(); var queueProcess = new QueueProcess(1000, queueVideoRepository.Object); queueVideoRepository.Setup(m => m.GetMessage()).Returns(queueMsg); //Act var queueInfo = queueProcess.ProcessMethod(null, new CancellationToken()); //Asert queueVideoRepository.Verify(m => m.GetMessage(), Times.Once()); Assert.AreEqual(1, queueProcess.BlockingCollection.Count); Assert.AreEqual(queueMsg, queueInfo.VideoMessage); }
public void QueuedSuccessfulTest() { //Arrange var queueMsg = new VideoMessage(); var queueVideoRepository = new Mock <IQueueVideoRepository>(); var queueProcess = new QueueProcess(1000, queueVideoRepository.Object); queueVideoRepository.Setup(m => m.GetMessage()).Returns(queueMsg); //Act var queueInfo = queueProcess.ProcessMethod(null, new CancellationToken()); //Asert queueVideoRepository.Verify(m => m.GetMessage(), Times.Once()); Assert.AreEqual(1, queueProcess.BlockingCollection.Count); Assert.AreEqual(queueMsg, queueInfo.VideoMessage); }