• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Mocks.SimpleOptionsWithArray类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CommandLine.Tests.Mocks.SimpleOptionsWithArray的典型用法代码示例。如果您正苦于以下问题:C# SimpleOptionsWithArray类的具体用法?C# SimpleOptionsWithArray怎么用?C# SimpleOptionsWithArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SimpleOptionsWithArray类属于CommandLine.Tests.Mocks命名空间,在下文中一共展示了SimpleOptionsWithArray类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ParseStringArrayOptionUsingShortNameWithValueAdjacent

        public void ParseStringArrayOptionUsingShortNameWithValueAdjacent()
        {
            var options = new SimpleOptionsWithArray();
            bool result = base.Parser.ParseArguments(new string[] { "-zapple", "kiwi" }, options);

            base.AssertParserSuccess(result);
            base.AssertArrayItemEqual(new string[] { "apple", "kiwi" }, options.StringArrayValue);
        }
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:8,代码来源:OptionArrayAttributeParsingFixture.cs


示例2: ParseStringArrayOptionUsingLongNameWithEqualSign

        public void ParseStringArrayOptionUsingLongNameWithEqualSign()
        {
            var options = new SimpleOptionsWithArray();
            bool result = base.Parser.ParseArguments(new string[] { "--strarr=apple", "kiwi" }, options);

            base.AssertParserSuccess(result);
            base.AssertArrayItemEqual(new string[] { "apple", "kiwi" }, options.StringArrayValue);
        }
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:8,代码来源:OptionArrayAttributeParsingFixture.cs


示例3: ParseStringArrayOptionUsingLongName

        public void ParseStringArrayOptionUsingLongName()
        {
            var options = new SimpleOptionsWithArray();
            bool result = base.Parser.ParseArguments(new string[] { "--strarr", "alfa", "beta", "gamma" }, options);

            base.AssertParserSuccess(result);
            base.AssertArrayItemEqual(new string[] { "alfa", "beta", "gamma" }, options.StringArrayValue);
        }
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:8,代码来源:OptionArrayAttributeParsingFixture.cs


示例4: ParseStringArrayOptionUsingShortNameAndStringOptionAfter

        public void ParseStringArrayOptionUsingShortNameAndStringOptionAfter()
        {
            var options = new SimpleOptionsWithArray();
            bool result = base.Parser.ParseArguments(new string[] { "-z", "one", "two", "three", "-s", "after" }, options);

            base.AssertParserSuccess(result);
            base.AssertArrayItemEqual(new string[] { "one", "two", "three" }, options.StringArrayValue);
            Assert.AreEqual("after", options.StringValue);
        }
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:9,代码来源:OptionArrayAttributeParsingFixture.cs


示例5: ParseCultureSpecificNumber

        public void ParseCultureSpecificNumber()
        {
            var actualCulture = Thread.CurrentThread.CurrentCulture;
            Thread.CurrentThread.CurrentCulture = new CultureInfo("it-IT");
            var options = new SimpleOptionsWithArray();
            bool result = base.Parser.ParseArguments(new string[] { "-q", "1,2", "1,23", "1,234" }, options);

            base.AssertParserSuccess(result);
            base.AssertArrayItemEqual(new double[] { 1.2, 1.23, 1.234 }, options.DoubleArrayValue);

            Thread.CurrentThread.CurrentCulture = actualCulture;
        }
开发者ID:wsky,项目名称:commandline,代码行数:12,代码来源:OptionArrayAttributeParsingFixture.cs


示例6: ParseCultureSpecificNumber

        public void ParseCultureSpecificNumber()
        {
            var actualCulture = Thread.CurrentThread.CurrentCulture;
            Thread.CurrentThread.CurrentCulture = new CultureInfo("it-IT");
            var options = new SimpleOptionsWithArray();
            Result = base.Parser.ParseArguments(new string[] { "-q", "1,2", "1,23", "1,234" }, options);

            ResultShouldBeTrue();
            base.ElementsShouldBeEqual(new double[] { 1.2, 1.23, 1.234 }, options.DoubleArrayValue);

            Thread.CurrentThread.CurrentCulture = actualCulture;
        }
开发者ID:marcells,项目名称:commandline,代码行数:12,代码来源:OptionArrayAttributeParsingFixture.cs


示例7: Parse_culture_specific_number

        public void Parse_culture_specific_number()
        {
            var actualCulture = Thread.CurrentThread.CurrentCulture;
            Thread.CurrentThread.CurrentCulture = new CultureInfo("it-IT");
            var options = new SimpleOptionsWithArray();
            var parser = new CommandLineParser();
            var result = parser.ParseArguments(new string[] { "-q", "1,2", "1,23", "1,234" }, options);

            result.Should().BeTrue();
            base.ElementsShouldBeEqual(new double[] { 1.2, 1.23, 1.234 }, options.DoubleArrayValue);

            Thread.CurrentThread.CurrentCulture = actualCulture;
        }
开发者ID:kopelli,项目名称:commandline,代码行数:13,代码来源:OptionArrayAttributeParsingFixture.cs


示例8: Parse_different_arrays_together__combination_one

        public void Parse_different_arrays_together__combination_one()
        {
            var options = new SimpleOptionsWithArray();
            var parser = new CommandLineParser();
            var result = parser.ParseArguments(new string[] {
                "-z", "one", "two", "three", "four",
                "-y", "1", "2", "3", "4",
                "-q", "0.1", "0.2", "0.3", "0.4"
            }, options);

            result.Should().BeTrue();
            base.ElementsShouldBeEqual(new string[] { "one", "two", "three", "four" }, options.StringArrayValue);
            base.ElementsShouldBeEqual(new int[] { 1, 2, 3, 4 }, options.IntegerArrayValue);
            base.ElementsShouldBeEqual(new double[] { .1, .2, .3, .4 }, options.DoubleArrayValue);

            options = new SimpleOptionsWithArray();
            parser = new CommandLineParser();
            result = parser.ParseArguments(new string[] {
                "-y", "1", "2", "3", "4",
                "-z", "one", "two", "three", "four",
                "-q", "0.1", "0.2", "0.3", "0.4"
            }, options);

            result.Should().BeTrue();
            base.ElementsShouldBeEqual(new int[] { 1, 2, 3, 4 }, options.IntegerArrayValue);
            base.ElementsShouldBeEqual(new string[] { "one", "two", "three", "four" }, options.StringArrayValue);
            base.ElementsShouldBeEqual(new double[] { .1, .2, .3, .4 }, options.DoubleArrayValue);

            options = new SimpleOptionsWithArray();
            parser = new CommandLineParser();
            result = parser.ParseArguments(new string[] {
                "-q", "0.1", "0.2", "0.3", "0.4",
                "-y", "1", "2", "3", "4",
                "-z", "one", "two", "three", "four"
            }, options);

            result.Should().BeTrue();
            base.ElementsShouldBeEqual(new double[] { .1, .2, .3, .4 }, options.DoubleArrayValue);
            base.ElementsShouldBeEqual(new int[] { 1, 2, 3, 4 }, options.IntegerArrayValue);
            base.ElementsShouldBeEqual(new string[] { "one", "two", "three", "four" }, options.StringArrayValue);
        }
开发者ID:kopelli,项目名称:commandline,代码行数:41,代码来源:OptionArrayAttributeParsingFixture.cs


示例9: ParseDifferentArraysTogether_CombinationOne

        public void ParseDifferentArraysTogether_CombinationOne()
        {
            var options = new SimpleOptionsWithArray();
            bool result = base.Parser.ParseArguments(new string[] {
                "-z", "one", "two", "three", "four",
                "-y", "1", "2", "3", "4",
                "-q", "0.1", "0.2", "0.3", "0.4"
            }, options);

            base.AssertParserSuccess(result);
            base.AssertArrayItemEqual(new string[] { "one", "two", "three", "four" }, options.StringArrayValue);
            base.AssertArrayItemEqual(new int[] { 1, 2, 3, 4 }, options.IntegerArrayValue);
            base.AssertArrayItemEqual(new double[] { .1, .2, .3, .4 }, options.DoubleArrayValue);

            options = new SimpleOptionsWithArray();
            result = base.Parser.ParseArguments(new string[] {
                "-y", "1", "2", "3", "4",
                "-z", "one", "two", "three", "four",
                "-q", "0.1", "0.2", "0.3", "0.4"
            }, options);

            base.AssertParserSuccess(result);
            base.AssertArrayItemEqual(new int[] { 1, 2, 3, 4 }, options.IntegerArrayValue);
            base.AssertArrayItemEqual(new string[] { "one", "two", "three", "four" }, options.StringArrayValue);
            base.AssertArrayItemEqual(new double[] { .1, .2, .3, .4 }, options.DoubleArrayValue);

            options = new SimpleOptionsWithArray();
            result = base.Parser.ParseArguments(new string[] {
                "-q", "0.1", "0.2", "0.3", "0.4",
                "-y", "1", "2", "3", "4",
                "-z", "one", "two", "three", "four"
            }, options);

            base.AssertParserSuccess(result);
            base.AssertArrayItemEqual(new double[] { .1, .2, .3, .4 }, options.DoubleArrayValue);
            base.AssertArrayItemEqual(new int[] { 1, 2, 3, 4 }, options.IntegerArrayValue);
            base.AssertArrayItemEqual(new string[] { "one", "two", "three", "four" }, options.StringArrayValue);
        }
开发者ID:wsky,项目名称:commandline,代码行数:38,代码来源:OptionArrayAttributeParsingFixture.cs


示例10: ParseDifferentArraysTogether_CombinationTwo

        public void ParseDifferentArraysTogether_CombinationTwo()
        {
            var options = new SimpleOptionsWithArray();
            bool result = base.Parser.ParseArguments(new string[] {
                "-z", "one", "two", "three", "four",
                "-y", "1", "2", "3", "4",
                "-q", "0.1", "0.2", "0.3", "0.4",
                "--string=after"
            }, options);

            base.AssertParserSuccess(result);
            base.AssertArrayItemEqual(new string[] { "one", "two", "three", "four" }, options.StringArrayValue);
            base.AssertArrayItemEqual(new int[] { 1, 2, 3, 4 }, options.IntegerArrayValue);
            base.AssertArrayItemEqual(new double[] { .1, .2, .3, .4 }, options.DoubleArrayValue);
            Assert.AreEqual("after", options.StringValue);

            options = new SimpleOptionsWithArray();
            result = base.Parser.ParseArguments(new string[] {
                "--string", "before",
                "-y", "1", "2", "3", "4",
                "-z", "one", "two", "three", "four",
                "-q", "0.1", "0.2", "0.3", "0.4"
            }, options);

            base.AssertParserSuccess(result);
            Assert.AreEqual("before", options.StringValue);
            base.AssertArrayItemEqual(new int[] { 1, 2, 3, 4 }, options.IntegerArrayValue);
            base.AssertArrayItemEqual(new string[] { "one", "two", "three", "four" }, options.StringArrayValue);
            base.AssertArrayItemEqual(new double[] { .1, .2, .3, .4 }, options.DoubleArrayValue);

            options = new SimpleOptionsWithArray();
            result = base.Parser.ParseArguments(new string[] {
                "-q", "0.1", "0.2", "0.3", "0.4",
                "-y", "1", "2", "3", "4",
                "-s", "near-the-center",
                "-z", "one", "two", "three", "four"
            }, options);

            base.AssertParserSuccess(result);
            base.AssertArrayItemEqual(new double[] { .1, .2, .3, .4 }, options.DoubleArrayValue);
            base.AssertArrayItemEqual(new int[] { 1, 2, 3, 4 }, options.IntegerArrayValue);
            Assert.AreEqual("near-the-center", options.StringValue);
            base.AssertArrayItemEqual(new string[] { "one", "two", "three", "four" }, options.StringArrayValue);

            options = new SimpleOptionsWithArray();
            result = base.Parser.ParseArguments(new string[] {
                "--switch",
                "-z", "one", "two", "three", "four",
                "-y", "1", "2", "3", "4",
                "-i", "1234",
                "-q", "0.1", "0.2", "0.3", "0.4",
                "--string", "I'm really playing with the parser!"
            }, options);

            base.AssertParserSuccess(result);
            Assert.IsTrue(options.BooleanValue);
            base.AssertArrayItemEqual(new string[] { "one", "two", "three", "four" }, options.StringArrayValue);
            base.AssertArrayItemEqual(new int[] { 1, 2, 3, 4 }, options.IntegerArrayValue);
            Assert.AreEqual(1234, options.IntegerValue);
            base.AssertArrayItemEqual(new double[] { .1, .2, .3, .4 }, options.DoubleArrayValue);
            Assert.AreEqual("I'm really playing with the parser!", options.StringValue);
        }
开发者ID:wsky,项目名称:commandline,代码行数:62,代码来源:OptionArrayAttributeParsingFixture.cs


示例11: ParseDoubleArrayOptionUsingShortName

        public void ParseDoubleArrayOptionUsingShortName()
        {
            var options = new SimpleOptionsWithArray();
            bool result = base.Parser.ParseArguments(new string[] { "-q", "0.1", "2.3", "0.9" }, options);

            base.AssertParserSuccess(result);
            base.AssertArrayItemEqual(new double[] { .1, 2.3, .9 }, options.DoubleArrayValue);
        }
开发者ID:wsky,项目名称:commandline,代码行数:8,代码来源:OptionArrayAttributeParsingFixture.cs


示例12: ParseStringArrayOptionUsingShortNameWithOptionsBeforeAndAfter

        public void ParseStringArrayOptionUsingShortNameWithOptionsBeforeAndAfter()
        {
            var options = new SimpleOptionsWithArray();
            Result = base.Parser.ParseArguments(new string[] {
                "-i", "191919", "-z", "one", "two", "three", "--switch", "--string=near" }, options);

            ResultShouldBeTrue();
            options.IntegerValue.Should().Equal(191919);
            base.ElementsShouldBeEqual(new string[] { "one", "two", "three" }, options.StringArrayValue);
            options.BooleanValue.Should().Be.True();
            options.StringValue.Should().Equal("near");
        }
开发者ID:marcells,项目名称:commandline,代码行数:12,代码来源:OptionArrayAttributeParsingFixture.cs


示例13: ParseStringArrayOptionUsingShortNameAndStringOptionBefore

        public void ParseStringArrayOptionUsingShortNameAndStringOptionBefore()
        {
            var options = new SimpleOptionsWithArray();
            Result = base.Parser.ParseArguments(new string[] { "-s", "before", "-z", "one", "two", "three" }, options);

            ResultShouldBeTrue();
            options.StringValue.Should().Equal("before");
            base.ElementsShouldBeEqual(new string[] { "one", "two", "three" }, options.StringArrayValue);
        }
开发者ID:marcells,项目名称:commandline,代码行数:9,代码来源:OptionArrayAttributeParsingFixture.cs


示例14: ParseStringArrayOptionUsingShortName

        public void ParseStringArrayOptionUsingShortName()
        {
            var options = new SimpleOptionsWithArray();
            Result = base.Parser.ParseArguments(new string[] { "-z", "alfa", "beta", "gamma" }, options);

            ResultShouldBeTrue();
            base.ElementsShouldBeEqual(new string[] { "alfa", "beta", "gamma" }, options.StringArrayValue);
        }
开发者ID:marcells,项目名称:commandline,代码行数:8,代码来源:OptionArrayAttributeParsingFixture.cs


示例15: PassingBadValueToAnIntegerArrayOptionFails

        public void PassingBadValueToAnIntegerArrayOptionFails()
        {
            var options = new SimpleOptionsWithArray();
            Result = base.Parser.ParseArguments(new string[] { "-y", "one", "2", "3" }, options);

            ResultShouldBeFalse();

            options = new SimpleOptionsWithArray();
            Result = base.Parser.ParseArguments(new string[] { "-yone", "2", "3" }, options);

            ResultShouldBeFalse();

            options = new SimpleOptionsWithArray();
            Result = base.Parser.ParseArguments(new string[] { "--intarr", "1", "two", "3" }, options);

            ResultShouldBeFalse();

            options = new SimpleOptionsWithArray();
            Result = base.Parser.ParseArguments(new string[] { "--intarr=1", "2", "three" }, options);

            ResultShouldBeFalse();
        }
开发者ID:marcells,项目名称:commandline,代码行数:22,代码来源:OptionArrayAttributeParsingFixture.cs


示例16: Parse_string_array_option_using_short_name_with_options_before_and_after

        public void Parse_string_array_option_using_short_name_with_options_before_and_after()
        {
            var options = new SimpleOptionsWithArray();
            var parser = new CommandLineParser();
            var result = parser.ParseArguments(new string[] {
                "-i", "191919", "-z", "one", "two", "three", "--switch", "--string=near" }, options);

            result.Should().BeTrue();
            options.IntegerValue.Should().Be(191919);
            base.ElementsShouldBeEqual(new string[] { "one", "two", "three" }, options.StringArrayValue);
            options.BooleanValue.Should().BeTrue();
            options.StringValue.Should().Be("near");
        }
开发者ID:kopelli,项目名称:commandline,代码行数:13,代码来源:OptionArrayAttributeParsingFixture.cs


示例17: PassingBadValueToAnIntegerArrayOptionFails

        public void PassingBadValueToAnIntegerArrayOptionFails()
        {
            var options = new SimpleOptionsWithArray();
            bool result = base.Parser.ParseArguments(new string[] { "-y", "one", "2", "3" }, options);

            base.AssertParserFailure(result);

            options = new SimpleOptionsWithArray();
            result = base.Parser.ParseArguments(new string[] { "-yone", "2", "3" }, options);

            base.AssertParserFailure(result);

            options = new SimpleOptionsWithArray();
            result = base.Parser.ParseArguments(new string[] { "--intarr", "1", "two", "3" }, options);

            base.AssertParserFailure(result);

            options = new SimpleOptionsWithArray();
            result = base.Parser.ParseArguments(new string[] { "--intarr=1", "2", "three" }, options);

            base.AssertParserFailure(result);
        }
开发者ID:wsky,项目名称:commandline,代码行数:22,代码来源:OptionArrayAttributeParsingFixture.cs


示例18: Parse_string_array_option_using_short_name

        public void Parse_string_array_option_using_short_name()
        {
            var options = new SimpleOptionsWithArray();
            var parser = new CommandLineParser();
            var result = parser.ParseArguments(new string[] { "-z", "alfa", "beta", "gamma" }, options);

            result.Should().BeTrue();
            base.ElementsShouldBeEqual(new string[] { "alfa", "beta", "gamma" }, options.StringArrayValue);
        }
开发者ID:kopelli,项目名称:commandline,代码行数:9,代码来源:OptionArrayAttributeParsingFixture.cs


示例19: ParseStringArrayOptionUsingShortNameWithValueAdjacent

        public void ParseStringArrayOptionUsingShortNameWithValueAdjacent()
        {
            var options = new SimpleOptionsWithArray();
            Result = base.Parser.ParseArguments(new string[] { "-zapple", "kiwi" }, options);

            ResultShouldBeTrue();
            base.ElementsShouldBeEqual(new string[] { "apple", "kiwi" }, options.StringArrayValue);
        }
开发者ID:marcells,项目名称:commandline,代码行数:8,代码来源:OptionArrayAttributeParsingFixture.cs


示例20: Parse_integer_array_option_using_short_name

        public void Parse_integer_array_option_using_short_name()
        {
            var options = new SimpleOptionsWithArray();
            var parser = new CommandLineParser();
            var result = parser.ParseArguments(new string[] { "-y", "1", "2", "3" }, options);

            result.Should().BeTrue();
            base.ElementsShouldBeEqual(new int[] { 1, 2, 3 }, options.IntegerArrayValue);
        }
开发者ID:kopelli,项目名称:commandline,代码行数:9,代码来源:OptionArrayAttributeParsingFixture.cs



注:本文中的CommandLine.Tests.Mocks.SimpleOptionsWithArray类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Text.HelpText类代码示例发布时间:2022-05-24
下一篇:
C# Mocks.NumberSetOptions类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap