public void With_AllParsedOptions() { // Arrange const bool isCountAllVisitsNeeded = true; const bool isPlayMode = true; const bool isVerboseMode = true; const bool isKeepRunningAfterStoryFinishedNeeded = true; var pluginNames = new List <string>(); var parsedOptions = new ParsedCommandLineOptions() { IsCountAllVisitsNeeded = isCountAllVisitsNeeded, IsPlayMode = isPlayMode, IsVerboseMode = isVerboseMode, IsKeepOpenAfterStoryFinishNeeded = isKeepRunningAfterStoryFinishedNeeded, PluginNames = pluginNames, }; var processedOptions = new CommandLineToolOptions(); var tool = new CommandLineTool(); // Act tool.ProcesFlags(parsedOptions, processedOptions); // Assert parsedOptions.Should().NotBeNull("because the parsed options object was given"); processedOptions.Should().NotBeNull("because the processed options object was given"); processedOptions.IsCountAllVisitsNeeded.Should().Be(isCountAllVisitsNeeded, "because it was given"); processedOptions.IsPlayMode.Should().Be(isPlayMode, "because it was given"); processedOptions.IsVerboseMode.Should().Be(isVerboseMode, "because it was given"); processedOptions.IsKeepRunningAfterStoryFinishedNeeded.Should().Be(isKeepRunningAfterStoryFinishedNeeded, "because it was given"); processedOptions.PluginNames.Should().BeEquivalentTo(pluginNames, "because it was given"); }
public void With_NullInputFileAndDirectory() { // Arrange var options = new CommandLineToolOptions(); // Act //var inklecate = new Ink.Inklecate.Program(options, null); // Assert // Without arguments the function should process nothing. }
public void ShowStats(CommandLineToolOptions options, Stats stats) { StringBuilder builder = new StringBuilder(); builder.Append("Words: ").Append(stats.words); builder.Append("Knots: ").Append(stats.knots); builder.Append("Stitches: ").Append(stats.stitches); builder.Append("Functions: ").Append(stats.functions); builder.Append("Choices: ").Append(stats.choices); builder.Append("Gathers: ").Append(stats.gathers); builder.Append("Diverts: ").Append(stats.diverts); ConsoleInteractor.WriteInformation(builder.ToString()); }
public void With_InkFile() { // Arrange var processedOptions = new CommandLineToolOptions() { InputFileName = "test.ink" }; // Act var isInputFileJson = processedOptions.IsInputFileJson; // Assert isInputFileJson.Should().BeFalse("because the given file has no JSON extension"); }
public void With_InputFountainFile() { // Arrange const string inputFilePath = @"generating_testfile.ink"; const string startingDirectory = @"C:\Test"; var parsedOptions = new ParsedCommandLineOptions() { InputFilePath = inputFilePath }; var processedOptions = new CommandLineToolOptions(); var tool = new CommandLineTool(); // Act tool.ProcesOutputFountainFilePath(parsedOptions, processedOptions, startingDirectory); // Assert parsedOptions.Should().NotBeNull("because the parsed options object was given"); processedOptions.Should().NotBeNull("because the processed options object was given"); processedOptions.RootedOutputFountainFilePath.Should().Be(@"C:\Test\generating_testfile.ink.fountain", "because it was given"); }
public void With_RootedOutputFilePath() { // Arrange const string outputFilePath = @"C:\Test\testfile.ink.json"; const string startingDirectory = @"C:\Test"; var parsedOptions = new ParsedCommandLineOptions() { OutputFilePath = outputFilePath }; var processedOptions = new CommandLineToolOptions(); var tool = new CommandLineTool(); // Act tool.ProcesOutputFilePath(parsedOptions, processedOptions, startingDirectory); // Assert parsedOptions.Should().NotBeNull("because the parsed options object was given"); processedOptions.Should().NotBeNull("because the processed options object was given"); processedOptions.RootedOutputFilePath.Should().Be(outputFilePath, "because it was given"); }
public void ShowStats(CommandLineToolOptions options, Stats stats) { var writer = new Runtime.SimpleJson.Writer(); writer.WriteObjectStart(); writer.WritePropertyStart("stats"); writer.WriteObjectStart(); writer.WriteProperty("words", stats.words); writer.WriteProperty("knots", stats.knots); writer.WriteProperty("stitches", stats.stitches); writer.WriteProperty("functions", stats.functions); writer.WriteProperty("choices", stats.choices); writer.WriteProperty("gathers", stats.gathers); writer.WriteProperty("diverts", stats.diverts); writer.WriteObjectEnd(); writer.WritePropertyEnd(); writer.WriteObjectEnd(); ConsoleInteractor.WriteJsonInformation(writer.ToString()); }
public void With_InputFile() { // Arrange const string inputFilePath = @"testfile.ink"; const string startingDirectory = @"C:\SomeFolder"; var parsedOptions = new ParsedCommandLineOptions() { InputFilePath = inputFilePath }; var processedOptions = new CommandLineToolOptions(); var tool = new CommandLineTool(); // Act tool.ProcesInputFilePath(parsedOptions, processedOptions, startingDirectory); // Assert parsedOptions.Should().NotBeNull("because the parsed options object was given"); processedOptions.Should().NotBeNull("because the processed options object was given"); processedOptions.InputFilePath.Should().Be(inputFilePath, "because it was given"); processedOptions.InputFileName.Should().Be(@"testfile.ink", "because that is the filename part of the path"); processedOptions.RootedInputFilePath.Should().Be(@"C:\SomeFolder\testfile.ink", "because combines the starting directory with the filename"); processedOptions.InputFileDirectory.Should().Be(startingDirectory, "because the starting directory should be the default"); }
public void ShowCompileSuccess(CommandLineToolOptions options, bool compileSuccess) { ConsoleInteractor.WriteJsonNameValuePair("compile-success", compileSuccess); }
public void ShowExportComplete(CommandLineToolOptions options) { ConsoleInteractor.WriteJsonNameValuePair("export-complete", true); }
public void ShowCompileSuccess(CommandLineToolOptions options, bool compileSuccess) { // We don't show compile success in the console }
public void ShowExportComplete(CommandLineToolOptions options) { // We don't show export complete in the console }