public void TestDefinition() { var def = new FormatFunction(); Assert.That(def.Name.Name, Is.EqualTo("format")); Assert.That(def.Parameters.Count, Is.EqualTo(2)); Assert.That(def.Parameters.ElementAt(0).Name, Is.EqualTo("format_string")); }
static void Main(string[] args) { App = new AppParams(args); // Open the file to read from. ReadText = File.ReadAllText(App.FilePath); ConvertedText = ReadText.CleanText(); WordCount = ConvertedText.GetWordCount(); #region Apply Formatting // Instantiate delegate FormatFunction FormatFunction = null; switch (App.Mode) { case "-stair": FormatFunction = FormatStair; break; case "-sine": FormatFunction = FormatSine; break; case "-tan": FormatFunction = FormatTangential; break; case "-blocks": FormatFunction = FormatBlocks; break; default: Console.WriteLine($"Don't know specified mode '{App.Mode}'"); App.PlotAppUsage(1); break; } FormatFunction(); #endregion string OutFilePath = $"{App.FilePath}.tart{Path.GetExtension(App.FilePath)}"; File.WriteAllText(OutFilePath, ConvertedText, Encoding.UTF8); }
public Formatter(string tag, int index, FormatFunction function) { this.tag = tag; this.index = index; this.function = function; }