Exemplo n.º 1
0
        public void Send_Args_ReturnsScanOptions(string[] args, string expectedPath, FormatType expectedFormat, IList <OutputStrategyType> expectedOutput)
        {
            CommandLineBuilder cmBuilder = Program.CreateCommandLineBuilder();
            Parser             parser    = new(cmBuilder.Command);

            ParseResult result = parser.Parse(args);

            DirectoryInfo path                = result.ValueForArgument <DirectoryInfo>("path");
            FormatType    formatType          = result.ValueForOption <FormatType>("--format");
            FormatType    formatTypeFromAlias = result.ValueForOption <FormatType>("-f");

            IEnumerable <OutputStrategyType> outputStrategyTypes          = result.ValueForOption <IEnumerable <OutputStrategyType> >("--output");
            IEnumerable <OutputStrategyType> outputStrategyTypesFromAlias = result.ValueForOption <IEnumerable <OutputStrategyType> >("-o");

            formatType.Should().Be(formatTypeFromAlias);

            outputStrategyTypes.Should().NotBeEmpty()
            .And.Equal(outputStrategyTypesFromAlias);

            path.Should().NotBeNull();
            path.FullName.Should().NotBeEmpty()
            .And.Be(expectedPath);

            formatType.Should()
            .Be(expectedFormat);

            outputStrategyTypes.Should().NotContainNulls();

            //Veryfy all required ones are present
            expectedOutput.Should().BeSubsetOf(outputStrategyTypes);

            //Veryfy there aren't extra output stragetegies added
            outputStrategyTypes.Should().BeSubsetOf(expectedOutput);
        }