From 06712c57a19c7fcd69b1b40181825d43a2863495 Mon Sep 17 00:00:00 2001 From: Chomp Date: Thu, 13 Jan 2022 15:29:55 +0000 Subject: [PATCH] Move function out into helper class --- .../Helpers/AssortHelper.cs | 21 +++++++++++++++++++ AssortValidator/Program.cs | 18 +--------------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/AssortValidator.Common/Helpers/AssortHelper.cs b/AssortValidator.Common/Helpers/AssortHelper.cs index b587a2e..ac566e0 100644 --- a/AssortValidator.Common/Helpers/AssortHelper.cs +++ b/AssortValidator.Common/Helpers/AssortHelper.cs @@ -1,5 +1,6 @@ using AssortHelpers.Common.Helpers; using AssortValidator.Common.Models; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -34,6 +35,26 @@ namespace AssortValidator.Common.Helpers return _assortDataCache; } + /// + /// Log to console if each trader was found in the supplied dictionary + /// + /// + public static void ListAssortFilesFound(Dictionary assortData) + { + foreach (var trader in Enum.GetValues(typeof(Trader)).Cast()) + { + var traderFound = assortData.ContainsKey(trader); + if (traderFound) + { + LoggingHelpers.LogSuccess($"Trader: {trader} found"); + } + else + { + LoggingHelpers.LogError($"Trader: {trader} NOT found"); + } + } + } + private static Trader GetTraderType(string filePath) { if (filePath.Contains("54cb50c76803fa8b248b4571")) diff --git a/AssortValidator/Program.cs b/AssortValidator/Program.cs index 0d39a6c..60a9f5f 100644 --- a/AssortValidator/Program.cs +++ b/AssortValidator/Program.cs @@ -21,29 +21,13 @@ namespace AssortValidator var assortData = AssortHelper.GetAssortData(); var liveAssortData = AssortHelper.GetLiveAssortData(); - ListAssortFilesFound(assortData); + AssortHelper.ListAssortFilesFound(assortData); ListAssortsInLiveNotInOffline(assortData, liveAssortData); AssortItemChecker.CheckAssortValues(assortData, liveAssortData); } - private static void ListAssortFilesFound(Dictionary assortData) - { - foreach (var trader in Enum.GetValues(typeof(Trader)).Cast()) - { - var traderFound = assortData.ContainsKey(trader); - if (traderFound) - { - LoggingHelpers.LogSuccess($"Trader: {trader} found"); - } - else - { - LoggingHelpers.LogError($"Trader: {trader} NOT found"); - } - } - } - private static void ListAssortsInLiveNotInOffline(Dictionary assortData, Dictionary liveAssortData) { foreach (var trader in liveAssortData)