Move function out into helper class

This commit is contained in:
Chomp 2022-01-13 15:29:55 +00:00
parent c523e257ab
commit 06712c57a1
2 changed files with 22 additions and 17 deletions

View File

@ -1,5 +1,6 @@
using AssortHelpers.Common.Helpers; using AssortHelpers.Common.Helpers;
using AssortValidator.Common.Models; using AssortValidator.Common.Models;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -34,6 +35,26 @@ namespace AssortValidator.Common.Helpers
return _assortDataCache; return _assortDataCache;
} }
/// <summary>
/// Log to console if each trader was found in the supplied dictionary
/// </summary>
/// <param name="assortData"></param>
public static void ListAssortFilesFound(Dictionary<Trader, Assort> assortData)
{
foreach (var trader in Enum.GetValues(typeof(Trader)).Cast<Trader>())
{
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) private static Trader GetTraderType(string filePath)
{ {
if (filePath.Contains("54cb50c76803fa8b248b4571")) if (filePath.Contains("54cb50c76803fa8b248b4571"))

View File

@ -21,29 +21,13 @@ namespace AssortValidator
var assortData = AssortHelper.GetAssortData(); var assortData = AssortHelper.GetAssortData();
var liveAssortData = AssortHelper.GetLiveAssortData(); var liveAssortData = AssortHelper.GetLiveAssortData();
ListAssortFilesFound(assortData); AssortHelper.ListAssortFilesFound(assortData);
ListAssortsInLiveNotInOffline(assortData, liveAssortData); ListAssortsInLiveNotInOffline(assortData, liveAssortData);
AssortItemChecker.CheckAssortValues(assortData, liveAssortData); AssortItemChecker.CheckAssortValues(assortData, liveAssortData);
} }
private static void ListAssortFilesFound(Dictionary<Trader, Assort> assortData)
{
foreach (var trader in Enum.GetValues(typeof(Trader)).Cast<Trader>())
{
var traderFound = assortData.ContainsKey(trader);
if (traderFound)
{
LoggingHelpers.LogSuccess($"Trader: {trader} found");
}
else
{
LoggingHelpers.LogError($"Trader: {trader} NOT found");
}
}
}
private static void ListAssortsInLiveNotInOffline(Dictionary<Trader, Assort> assortData, Dictionary<Trader, Assort> liveAssortData) private static void ListAssortsInLiveNotInOffline(Dictionary<Trader, Assort> assortData, Dictionary<Trader, Assort> liveAssortData)
{ {
foreach (var trader in liveAssortData) foreach (var trader in liveAssortData)