public void TaskLoggingQueue_Process_LogsMessages(string messageType, string message, LogLevel expectedLogLevel, MessageImportance?messageImportance = null)
        {
            var expected = new ConsoleOutLogMessage
            {
                MessageType = (ConsoleOutLogMessageType)Enum.Parse(typeof(ConsoleOutLogMessageType), messageType),
                Message     = message,
            };

            if (messageImportance.HasValue)
            {
                expected.Importance = messageImportance.Value;
            }

            var buildEngine = new TestBuildEngine();

            using (var loggingQueue = new TaskLoggingQueue(new TaskLoggingHelper(buildEngine, nameof(TaskLoggingQueueTests))))
            {
                loggingQueue.Enqueue(expected.ToJson());
            }

            var actual = buildEngine.TestLogger.LogMessages.Should().ContainSingle().Which;

            actual.Message.Should().Be(expected.Message);
            actual.Level.Should().Be(expectedLogLevel);
        }
        public void TaskLoggingQueue_Process_HandleBadMessage()
        {
            const string badMessage = "{ 'Importance': [] }";

            var buildEngine = new TestBuildEngine();

            using (var loggingQueue = new TaskLoggingQueue(new TaskLoggingHelper(buildEngine, nameof(TaskLoggingQueueTests))))
            {
                loggingQueue.Enqueue(badMessage);
            }

            buildEngine.TestLogger.DebugMessages.Should().ContainSingle()
            .Which.Should().Be(badMessage);
        }
        public void TaskLoggingQueue_Process_ThrowsIfInvalidMessageType()
        {
            const string badMessage = "{ 'MessageType': 200 }";

            var buildEngine = new TestBuildEngine();

            Action act = () =>
            {
                using (var loggingQueue = new TaskLoggingQueue(new TaskLoggingHelper(buildEngine, nameof(TaskLoggingQueueTests))))
                {
                    loggingQueue.Enqueue(badMessage);
                }
            };

            act.ShouldThrow <ArgumentOutOfRangeException>();
        }