Ejemplo n.º 1
0
        public void ParseCommonOptions_KmerFastaDoesntExist_DisplaysError(TemporaryDirectoryFixture tempDirectory)
        {
            // arrange
            Option<CommonOptions> commonOptionsParser = new CommonOptionsParser();
            var kmerFasta = tempDirectory.GetFileLocation("kmer.fa");
            var bAlleleVcf = tempDirectory.GetFileLocation("ballele.vcf").Touch();
            var filterBed = tempDirectory.GetFileLocation("filter.bed").Touch();
            var output = tempDirectory.CreateSubdirectory("output");
            var genome = tempDirectory.CreateSubdirectory("WholeGenomeFasta");
            string[] stringInputArgument =
            {
                "-r", kmerFasta.ToString(), "-o", output.ToString(), "-g", genome.ToString(), "--b-allele-vcf", bAlleleVcf.ToString(), "--filter-bed", filterBed.ToString(), "--sample-name", "SampleName"
            };

            // act
            ParsingResult<CommonOptions> result = commonOptionsParser.Parse(stringInputArgument);

            // assert
            Assert.False(result.Success);
            Assert.Contains("kmer.fa", result.ErrorMessage);
            Assert.Contains("does not exist", result.ErrorMessage);
        }
Ejemplo n.º 2
0
        public void ParseCommonOptions_WithRequiredArguments_ReturnsSuccessfulResult(TemporaryDirectoryFixture tempDirectory)
        {
            // arrange
            Option<CommonOptions> commonOptionsParser = new CommonOptionsParser();
            var kmerFasta = tempDirectory.CreateFile("kmer.fa");
            var bAlleleVcf = tempDirectory.GetFileLocation("ballele.vcf").Touch();
            var filterBed = tempDirectory.GetFileLocation("filter.bed").Touch();
            var output = tempDirectory.CreateSubdirectory("output");
            var genome = tempDirectory.CreateSubdirectory("WholeGenomeFasta");
            string[] stringInputArgument =
            {
                "-r", kmerFasta.ToString(), "-o", output.ToString(), "-g", genome.ToString(), "--b-allele-vcf", bAlleleVcf.ToString(), "--filter-bed", filterBed.ToString(), "--sample-name", "SampleName"
            };

            // act
            ParsingResult<CommonOptions> result = commonOptionsParser.Parse(stringInputArgument);

            // assert
            Assert.Equal("", result.ErrorMessage);
            Assert.True(result.Success);
            Assert.Equal(kmerFasta, result.Result.KmerFasta);
            Assert.Equal(output, result.Result.OutputDirectory);
            Assert.Equal(genome, result.Result.WholeGenomeFasta);
        }