Beispiel #1
0
        public void GermlineWgsParse_WithRequiredArguments_ReturnsSuccessfulCallsetResult(string name, string description, StringWriter standardWriter,
            StringWriter errorWriter, TemporaryDirectoryFixture tempDirectory)
        {
            // arrange
            GermlineWgsModeParser germlineWgsModeParser = new GermlineWgsModeParser(name, description);
            MainParser parser = GetMainParser(germlineWgsModeParser);
            string[] args =
            {
                "-h"
            };

            // act
            var result = parser.Parse(args, standardWriter, errorWriter);

            // assert
            Assert.True(result.Success);
        }
Beispiel #2
0
        public void Parse_NoArguments_DisplaysError(string messageToDisplay, string name, string description, StringWriter standardWriter,
            StringWriter errorWriter)
        {
            // arrange
            GermlineWgsModeParser germlineWgsModeParser = new GermlineWgsModeParser(name, description);
            MainParser parser = new MainParser(germlineWgsModeParser);
            string[] noArgs =
            {
            };

            // act
            var result = parser.Parse(noArgs, standardWriter, errorWriter);
            string errorOutput = errorWriter.ToString();

            // assert
            Assert.False(result.Success);
            Assert.Contains(messageToDisplay, errorOutput);
            Assert.Empty(standardWriter.ToString());
        }
Beispiel #3
0
        public void Parse_WithHelpArgument_ReturnsSuccecssAndDisplaysHelp(string messageToDisplay, string name, string description, StringWriter standardWriter,
            StringWriter errorWriter)
        {
            // arrange
            GermlineWgsModeParser germlineWgsModeParser = new GermlineWgsModeParser(name, description);
            MainParser parser = new MainParser(germlineWgsModeParser);
            string[] args =
            {
                "-h"
            };

            // act
            var result = parser.Parse(args, standardWriter, errorWriter);
            string standardOutput = standardWriter.ToString();

            // assert
            Assert.True(result.Success);
            Assert.Contains(messageToDisplay, standardOutput);
            Assert.Empty(errorWriter.ToString());
        }
Beispiel #4
0
        public void Parse_ModeWithVersion_ReturnsSuccecssAndDisplaysVersion(string messageToDisplay, string name, string description,
            StringWriter standardWriter, StringWriter errorWriter)
        {
            // arrange
            GermlineWgsModeParser germlineWgsModeParser = new GermlineWgsModeParser("WGS", "Run Canvas from WGS data");
            MainParser parser = new MainParser(germlineWgsModeParser);
            string[] modeArgs =
            {
                "WGS", "-v"
            };

            // act
            var result = parser.Parse(modeArgs, standardWriter, errorWriter);
            string output = standardWriter.ToString();

            // assert
            Assert.True(result.Success);
            string version = typeof(Program).Assembly.GetName().Version.ToString();
            Assert.Contains(version, output);
            Assert.Empty(errorWriter.ToString());
        }
Beispiel #5
0
        public void Parse_ModeWithMissingRequiredArgument_DisplaysError(string messageToDisplay, string name, string description, StringWriter standardWriter,
            StringWriter errorWriter)
        {
            // arrange
            GermlineWgsModeParser germlineWgsModeParser = new GermlineWgsModeParser("WGS", "Run Canvas from WGS data");
            MainParser parser = new MainParser(germlineWgsModeParser);
            string[] modeArgs =
            {
                "WGS"
            };

            // act
            parser.Parse(modeArgs, standardWriter, errorWriter);
            string errorOutput = errorWriter.ToString();

            // assert
            Assert.Contains(messageToDisplay, errorOutput);
            Assert.Empty(standardWriter.ToString());
        }
Beispiel #6
0
 private static MainParser GetMainParser(GermlineWgsModeParser germlineWgsModeParser)
 {
     return new MainParser(Version, Copyright, germlineWgsModeParser);
 }
Beispiel #7
0
        public void Parse_WithHelpArgumentAndUnkownArgument_DisplaysError(string messageToDisplay, string name, string description, StringWriter standardWriter,
            StringWriter errorWriter)
        {
            // arrange
            GermlineWgsModeParser germlineWgsModeParser = new GermlineWgsModeParser(name, description);
            MainParser parser = GetMainParser(germlineWgsModeParser);
            string[] args =
            {
                "-h", "--unknown-option"
            };

            // act
            var result = parser.Parse(args, standardWriter, errorWriter);
            string errorOutput = errorWriter.ToString();

            // assert
            Assert.False(result.Success);
            Assert.Contains(messageToDisplay, errorOutput);
            Assert.Empty(standardWriter.ToString());
        }