Parse() публичный Метод

public Parse ( string args, TextWriter standardWriter, TextWriter errorWriter ) : ParsingResult
args string
standardWriter System.IO.TextWriter
errorWriter System.IO.TextWriter
Результат ParsingResult
Пример #1
0
 public static int Main(string[] args)
 {
     var modeParser = new MainParser(CanvasVersionInfo.VersionString, CanvasVersionInfo.CopyrightString,
         new GermlineWgsModeParser("Germline-WGS", "CNV calling of a germline sample from whole genome sequencing data"),
         new SomaticEnrichmentModeParser("Somatic-Enrichment", "CNV calling of a somatic sample from targeted sequencing data"),
         new TumorNormalWgsModeParser("Somatic-WGS", "CNV calling of a somatic sample from whole genome sequencing data"),
         new TumorNormalEnrichmentModeParser("Tumor-normal-enrichment", "CNV calling of a tumor/normal pair from targeted sequencing data"));
     var result = modeParser.Parse(args, Console.Out, Console.Error);
     if (!result.Success)
         return -1;
     return result.Result.Launch();
 }
Пример #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());
        }
Пример #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());
        }
Пример #4
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 = new MainParser(germlineWgsModeParser);
            string[] args =
            {
                "-h"
            };

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

            // assert
            Assert.True(result.Success);
        }
Пример #5
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());
        }
Пример #6
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());
        }