Beispiel #1
0
        public void Remove_FailsWhenOperationIsNull()
        {
            // Arrage
            var queue = new AsyncResultQueue <AsyncResult>();

            // Act
            var result = queue.Remove(null);

            // Assert
            Assert.False(result);
        }
Beispiel #2
0
        public void Remove_FailsWhenQueueIsEmpty()
        {
            // Arrage
            var op    = new AsyncResult();
            var queue = new AsyncResultQueue <AsyncResult>();

            // Act
            var result = queue.Remove(op);

            // Assert
            Assert.False(result);
        }
Beispiel #3
0
        public void Remove_RemovesExistingOperation()
        {
            // Arrage
            var op    = new AsyncResult();
            var queue = new AsyncResultQueue <AsyncResult>()
            {
                op
            };

            // Act
            var result = queue.Remove(op);

            // Assert
            Assert.True(result);
            Assert.True(queue.IsEmpty);
            Assert.Empty(queue);
            Assert.Null(queue.Current);
        }
Beispiel #4
0
        public void Remove_FailsWhenOperationIsNotInQueue()
        {
            // Arrage
            var op    = new AsyncResult();
            var op2   = new AsyncResult();
            var queue = new AsyncResultQueue <AsyncResult>()
            {
                op
            };

            // Act
            var result = queue.Remove(op2);

            // Assert
            Assert.False(result);
            Assert.False(queue.IsEmpty);
            Assert.NotEmpty(queue);
            Assert.Equal(op, queue.Current);
        }