From f4fb8e8d9e17a1131a147cb5eff1e6f393b74698 Mon Sep 17 00:00:00 2001 From: Giacomo Castellani Date: Mon, 7 Nov 2022 21:01:32 +0100 Subject: [PATCH] new color palette --- src/qest/Visualizers/ConsoleVisualizer.cs | 19 +++++++++++-------- src/qest/Visualizers/TreeVisualizer.cs | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/qest/Visualizers/ConsoleVisualizer.cs b/src/qest/Visualizers/ConsoleVisualizer.cs index 10c432d..657ed90 100644 --- a/src/qest/Visualizers/ConsoleVisualizer.cs +++ b/src/qest/Visualizers/ConsoleVisualizer.cs @@ -13,7 +13,10 @@ namespace qest.Visualizers private Test Test; private bool Pass; - private const string objectStyle = "blue"; + private const string objectStyle_l1 = "blue"; + private const string objectStyle_l2 = "cornflowerblue"; + private const string objectStyle_l3 = "steelblue1"; + private const string errorStyle = "bold red"; private const string okStyle = "green"; @@ -42,7 +45,7 @@ public async Task RunAllAsync() foreach (var currentTest in TestCollection) { - LogHierarchy.Add($"{currentTest.Name}".EscapeAndAddStyles($"bold {objectStyle}")); + LogHierarchy.Add($"{currentTest.Name}".EscapeAndAddStyles($"bold {objectStyle_l1}")); Test = currentTest; @@ -78,7 +81,7 @@ private async Task RunSingleTestAsync() foreach (var testCase in Test.Steps) { - LogHierarchy.Add($"{testCase.Name.EscapeAndAddStyles(objectStyle)}"); + LogHierarchy.Add($"{testCase.Name.EscapeAndAddStyles(objectStyle_l2)}"); EvaluateTestStep(testCase, Test.Variables); LogHierarchy.RemoveLast(); } @@ -117,7 +120,7 @@ private void EvaluateTestStep(TestStep step, Dictionary? variabl foreach (var expectedResult in step.Results.ResultSets) { - LogHierarchy.Add(expectedResult.Name.EscapeAndAddStyles(objectStyle)); + LogHierarchy.Add(expectedResult.Name.EscapeAndAddStyles(objectStyle_l3)); var currentResult = expectedResult.Result; @@ -160,7 +163,7 @@ private void EvaluateTestStep(TestStep step, Dictionary? variabl foreach (var expectedResult in step.Results.OutputParameters) { var currentResult = expectedResult.Result; - LogHierarchy.Add($"{expectedResult.Name}".EscapeAndAddStyles(objectStyle)); + LogHierarchy.Add($"{expectedResult.Name}".EscapeAndAddStyles(objectStyle_l3)); if (currentResult is null) { @@ -192,7 +195,7 @@ private void EvaluateTestStep(TestStep step, Dictionary? variabl //returncode if (step.Results.ReturnCode.HasValue) { - LogHierarchy.Add("Return Code".EscapeAndAddStyles(objectStyle)); + LogHierarchy.Add("Return Code".EscapeAndAddStyles(objectStyle_l3)); var expectedResult = step.Results.ReturnCode.Value; var currentResult = step.Results.ReturnCodeResult; @@ -233,7 +236,7 @@ private void EvaluateTestStep(TestStep step, Dictionary? variabl var assertSqlQuery = assert.SqlQuery.ReplaceVars(Test.Variables); var assertScalarValue = assert.ScalarValue.ReplaceVarsInParameter(Test.Variables); var currentResult = assert.Result; - LogHierarchy.Add(assertSqlQuery.EscapeAndAddStyles(objectStyle)); + LogHierarchy.Add(assertSqlQuery.EscapeAndAddStyles(objectStyle_l3)); if (assert.ResultException is not null) { @@ -270,7 +273,7 @@ private void EvaluateTestStep(TestStep step, Dictionary? variabl private void EvaluateScript(string scope, Scripts scripts) { - string objName = scope.EscapeAndAddStyles(objectStyle); + string objName = scope.EscapeAndAddStyles(objectStyle_l2); LogHierarchy.Add(objName); if (scripts.Result) diff --git a/src/qest/Visualizers/TreeVisualizer.cs b/src/qest/Visualizers/TreeVisualizer.cs index 3c45038..05ae397 100644 --- a/src/qest/Visualizers/TreeVisualizer.cs +++ b/src/qest/Visualizers/TreeVisualizer.cs @@ -14,7 +14,10 @@ namespace qest.Visualizers private TreeNode MainNode; private bool Pass; - private const string objectStyle = "blue"; + private const string objectStyle_l1 = "blue"; + private const string objectStyle_l2 = "cornflowerblue"; + private const string objectStyle_l3 = "steelblue1"; + private const string errorStyle = "bold red"; private const string okStyle = "green"; @@ -37,7 +40,7 @@ public async Task RunAllAsync() foreach (var currentTest in TestCollection) { - var testNode = root.AddNode($"{currentTest.Name}".EscapeAndAddStyles($"bold {objectStyle}")); + var testNode = root.AddNode($"{currentTest.Name}".EscapeAndAddStyles($"bold {objectStyle_l1}")); MainNode = testNode; Test = currentTest; @@ -74,7 +77,7 @@ private async Task RunSingleTestAsync() foreach (var testCase in Test.Steps) { - var testCaseNode = MainNode.AddNode($"Step: {testCase.Name.EscapeAndAddStyles(objectStyle)}"); + var testCaseNode = MainNode.AddNode($"Step: {testCase.Name.EscapeAndAddStyles(objectStyle_l2)}"); EvaluateTestStep(testCase, Test.Variables, testCaseNode); } @@ -111,7 +114,7 @@ private void EvaluateTestStep(TestStep step, Dictionary? variabl foreach (var expectedResult in step.Results.ResultSets) { - var currentResultNode = resultSetsNode.AddNode(expectedResult.Name.EscapeAndAddStyles(objectStyle)); + var currentResultNode = resultSetsNode.AddNode(expectedResult.Name.EscapeAndAddStyles(objectStyle_l3)); var currentResult = expectedResult.Result; @@ -150,7 +153,7 @@ private void EvaluateTestStep(TestStep step, Dictionary? variabl foreach (var expectedResult in step.Results.OutputParameters) { var currentResult = expectedResult.Result; - var currentResultNode = outputParametersNode.AddNode($"{expectedResult.Name}".EscapeAndAddStyles(objectStyle)); + var currentResultNode = outputParametersNode.AddNode($"{expectedResult.Name}".EscapeAndAddStyles(objectStyle_l3)); if (currentResult is null) { @@ -177,7 +180,7 @@ private void EvaluateTestStep(TestStep step, Dictionary? variabl //returncode if (step.Results.ReturnCode.HasValue) { - var rcNode = testCaseNode.AddNode("Return Code".EscapeAndAddStyles(objectStyle)); + var rcNode = testCaseNode.AddNode("Return Code".EscapeAndAddStyles(objectStyle_l3)); var expectedResult = step.Results.ReturnCode.Value; var currentResult = step.Results.ReturnCodeResult; @@ -217,7 +220,7 @@ private void EvaluateTestStep(TestStep step, Dictionary? variabl var assertSqlQuery = assert.SqlQuery.ReplaceVars(Test.Variables); var assertScalarValue = assert.ScalarValue.ReplaceVarsInParameter(Test.Variables); var currentResult = assert.Result; - var currentResultNode = assertsNode.AddNode(assertSqlQuery.EscapeAndAddStyles(objectStyle)); + var currentResultNode = assertsNode.AddNode(assertSqlQuery.EscapeAndAddStyles(objectStyle_l3)); if (assert.ResultException is not null) { @@ -251,7 +254,7 @@ private void EvaluateTestStep(TestStep step, Dictionary? variabl private void EvaluateScript(string scope, Scripts scripts, TreeNode root) { - string objName = scope.EscapeAndAddStyles(objectStyle); + string objName = scope.EscapeAndAddStyles(objectStyle_l2); var scriptsNode = root.AddNode($"Scripts: {objName}"); if (scripts.Result)