private static void Execute(IList <string> files, IRebalanceInfoFormatter formatter, IFileSystem fileSystem) { IDictionary <string, List <ItemInfo> > weaponNames = AlliedModsWiki.GetItemInfos(); var itemInfoSource = new ItemInfoSource(weaponNames); var classNameSource = new ClassNameSource(); var transformations = new Dictionary <string, ITransformation <Node> > { { "tf2rebalance_attributes", new Tf2RebalanceTransformation(itemInfoSource, classNameSource) }, { "Custom Attributes", new CustomAttributesTransformation(itemInfoSource, classNameSource) }, }; IConverter converter = new CompositeTf2FormatConverter(new ValveFormatParser(), transformations); foreach (string filename in files) { CreateSummary(filename, converter, formatter, fileSystem); } Log.Information("finished creating summaries for {ConfigFileCount} configs", files.Count); }
public void Error(string inputFilename) { string input = File.ReadAllText(inputFilename); IConverter rebalanceInfoConverter = new CompositeTf2FormatConverter(new ValveFormatParser(), _transformations); Assert.ThrowsException <InvalidInputException>(() => rebalanceInfoConverter.Execute(input)); }
public void GroupedJson(string inputFilename, string expectedOutputFilename) { string input = File.ReadAllText(inputFilename); IConverter rebalanceInfoConverter = new CompositeTf2FormatConverter(new ValveFormatParser(), _transformations); IRebalanceInfoFormatter formatter = new RebalanceInfoGroupedJsonFormatter(); IEnumerable <RebalanceInfo> rebalanceInfos = rebalanceInfoConverter.Execute(input); string output = formatter.Create(rebalanceInfos); string expectedOutput = File.ReadAllText(expectedOutputFilename); Assert.AreEqual(expectedOutput, output); }