コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }