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");
            }
Exemple #2
0
            public void With_NoInputPathGiven()
            {
                // Arrange
                var parsedCommandLineOptions = new ParsedCommandLineOptions();

                // Act
                var isInputPathNotGiven = parsedCommandLineOptions.IsInputPathGiven;

                // Assert
                isInputPathNotGiven.Should().BeFalse("because there was no input file given");
            }
Exemple #3
0
            public void With_InputPathGiven()
            {
                // Arrange
                var parsedCommandLineOptions = new ParsedCommandLineOptions()
                {
                    InputFilePath = "test.ink"
                };

                // Act
                var isInputPathNotGiven = parsedCommandLineOptions.IsInputPathGiven;

                // Assert
                isInputPathNotGiven.Should().BeTrue("because there was an input file given");
            }
            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 With_CountAllVisitsAndOutputFile()
            {
                // Arrange
                var          options        = new ParsedCommandLineOptions();
                const string ArgumentString = "-c test.ink";

                string[] args = ArgumentString.Split(" ");
                var      tool = new CommandLineTool();

                // Act
                tool.ParseArguments(args, options);

                // Assert
                options.Should().NotBeNull("because the parsing should succeed");

                options.InputFilePath.Should().BeEquivalentTo("test.ink");

                options.OutputFilePath.Should().BeNull("because none was given");
                options.IsCountAllVisitsNeeded.Should().BeTrue("because the count all visits flag was set");
                options.IsPlayMode.Should().BeFalse("because the playmode flag was not set");
                options.IsVerboseMode.Should().BeFalse("because the verbose flag was not set");
                options.IsKeepOpenAfterStoryFinishNeeded.Should().BeFalse("because the keep running after finished flag was not set");
            }
            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");
            }