Skip to content

Commit

Permalink
new color palette
Browse files Browse the repository at this point in the history
  • Loading branch information
gicastel committed Nov 7, 2022
1 parent 5d43dba commit f4fb8e8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
19 changes: 11 additions & 8 deletions src/qest/Visualizers/ConsoleVisualizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -42,7 +45,7 @@ public async Task<int> RunAllAsync()

foreach (var currentTest in TestCollection)
{
LogHierarchy.Add($"{currentTest.Name}".EscapeAndAddStyles($"bold {objectStyle}"));
LogHierarchy.Add($"{currentTest.Name}".EscapeAndAddStyles($"bold {objectStyle_l1}"));

Test = currentTest;

Expand Down Expand Up @@ -78,7 +81,7 @@ private async Task<bool> 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();
}
Expand Down Expand Up @@ -117,7 +120,7 @@ private void EvaluateTestStep(TestStep step, Dictionary<string, object>? 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;

Expand Down Expand Up @@ -160,7 +163,7 @@ private void EvaluateTestStep(TestStep step, Dictionary<string, object>? 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)
{
Expand Down Expand Up @@ -192,7 +195,7 @@ private void EvaluateTestStep(TestStep step, Dictionary<string, object>? 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;

Expand Down Expand Up @@ -233,7 +236,7 @@ private void EvaluateTestStep(TestStep step, Dictionary<string, object>? 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)
{
Expand Down Expand Up @@ -270,7 +273,7 @@ private void EvaluateTestStep(TestStep step, Dictionary<string, object>? 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)
Expand Down
19 changes: 11 additions & 8 deletions src/qest/Visualizers/TreeVisualizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -37,7 +40,7 @@ public async Task<int> 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;
Expand Down Expand Up @@ -74,7 +77,7 @@ private async Task<bool> 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);
}

Expand Down Expand Up @@ -111,7 +114,7 @@ private void EvaluateTestStep(TestStep step, Dictionary<string, object>? 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;

Expand Down Expand Up @@ -150,7 +153,7 @@ private void EvaluateTestStep(TestStep step, Dictionary<string, object>? 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)
{
Expand All @@ -177,7 +180,7 @@ private void EvaluateTestStep(TestStep step, Dictionary<string, object>? 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;

Expand Down Expand Up @@ -217,7 +220,7 @@ private void EvaluateTestStep(TestStep step, Dictionary<string, object>? 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)
{
Expand Down Expand Up @@ -251,7 +254,7 @@ private void EvaluateTestStep(TestStep step, Dictionary<string, object>? 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)
Expand Down

0 comments on commit f4fb8e8

Please sign in to comment.