コード例 #1
0
        public void IsCompleteShouldReturnFalseIfAllPacketsHaveBeenRead()
        {
            // Arrange
            var stream = new MessageBusReadStream { LastPacketNumber = 3, CompleteEventHandler = CompleteEventHandler };
            var bytes = new byte[10];
            stream.Write(bytes, 1);
            stream.Write(bytes, 2);

            // Act
            var result = stream.IsComplete();

            // Assert
            Assert.False(result);
        }
コード例 #2
0
        public void IsCompleteShouldExecuteCompleteEventHandlerIfAllPacketsHaveBeenRead()
        {
            // Arrange
            var stream = new MessageBusReadStream { LastPacketNumber = 3, CompleteEventHandler = CompleteEventHandler };
            var bytes = new byte[10];
            stream.Write(bytes, 1);
            stream.Write(bytes, 2);
            stream.Read();
            stream.Read();

            // Act
            stream.IsComplete();

            // Assert
            Assert.True(_complete);
        }