Example #1
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);
        }
Example #2
0
        public void ParseCommonOptions_KmerFastaDoesntExist_DisplaysError(TemporaryDirectoryFixture tempDirectory)
        {
            // arrange
            Option <CommonOptions> commonOptionsParser = new CommonOptionsParser();
            var kmerFasta = tempDirectory.GetFileLocation("kmerv2.fa");
            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(), "--filter-bed", filterBed.ToString()
            };

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

            // assert
            Assert.False(result.Success);
            Assert.Contains("kmerv2.fa", result.ErrorMessage);
            Assert.Contains("does not exist", result.ErrorMessage);
        }