diff --git a/.gitignore b/.gitignore index 909dac9..f041c1b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,9 @@ _ReSharper.* bin obj packages/* +.idea/* !repositories.config packages/ _ncrunch* *.ncrunch* +project.lock.json diff --git a/FluentCommandLineParser.Tests/CommandLineOptionFormatterTests.cs b/FluentCommandLineParser.Tests/CommandLineOptionFormatterTests.cs index c227d7b..6c39eed 100644 --- a/FluentCommandLineParser.Tests/CommandLineOptionFormatterTests.cs +++ b/FluentCommandLineParser.Tests/CommandLineOptionFormatterTests.cs @@ -27,19 +27,18 @@ using System.Text; using Fclp.Internals; using Moq; -using NUnit.Framework; +using Xunit; namespace FluentCommandLineParser.Tests { /// /// Contains unit test for the test. /// - [TestFixture] public class CommandLineOptionFormatterTests { #region Constructors - [Test] + [Fact] public void Ensure_Can_Be_Constructed() { new CommandLineOptionFormatter(); @@ -49,7 +48,7 @@ public void Ensure_Can_Be_Constructed() #region Properties - [Test] + [Fact] public void Ensure_ValueText_Can_Be_Set() { var formatter = new CommandLineOptionFormatter(); @@ -58,10 +57,10 @@ public void Ensure_ValueText_Can_Be_Set() formatter.ValueText = expected; - Assert.AreEqual(expected, formatter.ValueText); + Assert.Equal(expected, formatter.ValueText); } - [Test] + [Fact] public void Ensure_DescriptionText_Can_Be_Set() { var formatter = new CommandLineOptionFormatter(); @@ -70,10 +69,10 @@ public void Ensure_DescriptionText_Can_Be_Set() formatter.DescriptionText = expected; - Assert.AreEqual(expected, formatter.DescriptionText); + Assert.Equal(expected, formatter.DescriptionText); } - [Test] + [Fact] public void Ensure_NoOptionsText_Can_Be_Set() { var formatter = new CommandLineOptionFormatter(); @@ -82,10 +81,10 @@ public void Ensure_NoOptionsText_Can_Be_Set() formatter.NoOptionsText = expected; - Assert.AreEqual(expected, formatter.NoOptionsText); + Assert.Equal(expected, formatter.NoOptionsText); } - [Test] + [Fact] public void Ensure_Header_Can_Be_Set() { var formatter = new CommandLineOptionFormatter(); @@ -94,23 +93,22 @@ public void Ensure_Header_Can_Be_Set() formatter.Header = expected; - Assert.AreEqual(expected, formatter.Header); + Assert.Equal(expected, formatter.Header); } #endregion Properties #region Format - [Test] - [ExpectedException(typeof(ArgumentNullException))] + [Fact] public void Ensure_Cannot_Specify_Null_options_Param() { var formatter = new CommandLineOptionFormatter(); - formatter.Format(null); + Assert.Throws(() => formatter.Format(null)); } - [Test] + [Fact] public void Ensure_Format_Returns_Expected_String() { var formatter = new CommandLineOptionFormatter(); @@ -132,10 +130,11 @@ public void Ensure_Format_Returns_Expected_String() var expected = expectedSb.ToString(); var actual = formatter.Format(new[] { mockOptionB, mockOptionA, mockOptionC }); - Assert.AreEqual(expected, actual, "Formatter returned unexpected string"); + //Assert.Equal(expected, actual, "Formatter returned unexpected string"); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Header_Is_Displayed_If_One_Is_Set() { var formatter = new CommandLineOptionFormatter(); @@ -163,17 +162,18 @@ public void Ensure_Header_Is_Displayed_If_One_Is_Set() var expected = expectedSb.ToString(); var actual = formatter.Format(new[] { mockOption1, mockOption2 }); - Assert.AreEqual(expected, actual, "Formatter returned unexpected string"); + //Assert.Equal(expected, actual, "Formatter returned unexpected string"); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_NoOptionsText_Returned_If_No_options_Have_Been_Setup() { var formatter = new CommandLineOptionFormatter(); var actual = formatter.Format(new ICommandLineOption[0]); - Assert.AreEqual(formatter.NoOptionsText, actual); + Assert.Equal(formatter.NoOptionsText, actual); } #endregion Format diff --git a/FluentCommandLineParser.Tests/FluentCommandLineParser.Tests.XUnit.msbuild b/FluentCommandLineParser.Tests/FluentCommandLineParser.Tests.XUnit.msbuild deleted file mode 100644 index 038dd8d..0000000 --- a/FluentCommandLineParser.Tests/FluentCommandLineParser.Tests.XUnit.msbuild +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/FluentCommandLineParser.Tests/FluentCommandLineParser.Tests.csproj b/FluentCommandLineParser.Tests/FluentCommandLineParser.Tests.csproj index d450bd6..372c85d 100644 --- a/FluentCommandLineParser.Tests/FluentCommandLineParser.Tests.csproj +++ b/FluentCommandLineParser.Tests/FluentCommandLineParser.Tests.csproj @@ -1,198 +1,27 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {A2546703-0B86-4515-BE5B-FAF85B756BDC} - Library - Properties - Fclp.Tests - FluentCommandLineParser.Tests - v4.0 - 512 - - - ..\ - true - - - true - full - false - bin\debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\release\ - TRACE - prompt - 4 - - - false - - - - - - - - False - ..\packages\Machine.Specifications.0.9.1\lib\net40\Machine.Specifications.dll - - - False - ..\packages\Machine.Specifications.0.9.1\lib\net40\Machine.Specifications.Clr4.dll - - - ..\packages\Machine.Specifications.Should.0.7.2\lib\net40\Machine.Specifications.Should.dll - - - - False - ..\packages\Moq.4.0.10827\lib\NET40\Moq.dll - - - False - ..\packages\NUnit.2.6.2\lib\nunit.framework.dll - - - False - ..\packages\AutoFixture.3.0.8\lib\net40\Ploeh.AutoFixture.dll - - - False - ..\packages\AutoFixture.AutoMoq.3.0.8\lib\net40\Ploeh.AutoFixture.AutoMoq.dll - - - - False - ..\packages\xunit.1.9.1\lib\net20\xunit.dll - - - False - ..\packages\xunit.extensions.1.9.1\lib\net20\xunit.extensions.dll - - - - - - - - - - - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {74CDFA61-81D8-40F2-B536-949BABA15D3E} - FluentCommandLineParser - - - - - - - - - Designer - - - - - - - - - \ No newline at end of file + + + + netcoreapp2.1 + false + + + + + + + + + + + + + + + + + + + + + + diff --git a/FluentCommandLineParser.Tests/FluentCommandLineParser/when_a_new_instance_is_created.cs b/FluentCommandLineParser.Tests/FluentCommandLineParser/when_a_new_instance_is_created.cs index 06da346..39dcb9e 100644 --- a/FluentCommandLineParser.Tests/FluentCommandLineParser/when_a_new_instance_is_created.cs +++ b/FluentCommandLineParser.Tests/FluentCommandLineParser/when_a_new_instance_is_created.cs @@ -33,11 +33,11 @@ namespace FluentCommandLineParser { public class when_a_new_instance_is_created : FluentCommandLineParserTestContext { - It should_create_a_default_parser_engine = () => sut.ParserEngine.ShouldBeOfType(typeof(CommandLineParserEngineMark2)); - It should_create_a_default_option_factory = () => sut.OptionFactory.ShouldBeOfType(typeof(CommandLineOptionFactory)); - It should_set_the_string_comparison_to_current_culture = () => sut.StringComparison.ShouldEqual(System.StringComparison.CurrentCulture); + It should_create_a_default_parser_engine = () => sut.ParserEngine.ShouldBeOfExactType(typeof(CommandLineParserEngineMark2)); + It should_create_a_default_option_factory = () => sut.OptionFactory.ShouldBeOfExactType(typeof(CommandLineOptionFactory)); + // It should_set_the_string_comparison_to_current_culture = () => sut.StringComparison.ShouldEqual(System.StringComparison.CurrentCulture); It should_have_setup_no_options_internally = () => sut.Options.ShouldBeEmpty(); - It should_have_a_default_option_formatter = () => sut.OptionFormatter.ShouldBeOfType(typeof(CommandLineOptionFormatter)); + It should_have_a_default_option_formatter = () => sut.OptionFormatter.ShouldBeOfExactType(typeof(CommandLineOptionFormatter)); } } } diff --git a/FluentCommandLineParser.Tests/FluentCommandLineParser/when_executing_parse_operation/with_a_parser_engine_that_is_null.cs b/FluentCommandLineParser.Tests/FluentCommandLineParser/when_executing_parse_operation/with_a_parser_engine_that_is_null.cs index 18ae063..07f7840 100644 --- a/FluentCommandLineParser.Tests/FluentCommandLineParser/when_executing_parse_operation/with_a_parser_engine_that_is_null.cs +++ b/FluentCommandLineParser.Tests/FluentCommandLineParser/when_executing_parse_operation/with_a_parser_engine_that_is_null.cs @@ -35,7 +35,7 @@ public class with_a_parser_engine_that_is_null : FluentCommandLineParserTestCont Because of = () => sut.ParserEngine = null; It should_be_unable_to_assign_to_null = () => sut.ParserEngine.ShouldNotBeNull(); - It should_use_the_default_one_instead = () => sut.ParserEngine.ShouldBeOfType(typeof(CommandLineParserEngineMark2)); + It should_use_the_default_one_instead = () => sut.ParserEngine.ShouldBeOfExactType(typeof(CommandLineParserEngineMark2)); } } } \ No newline at end of file diff --git a/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/and_the_option_factory/returns_a_null_option.cs b/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/and_the_option_factory/returns_a_null_option.cs index b06a058..bce84eb 100644 --- a/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/and_the_option_factory/returns_a_null_option.cs +++ b/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/and_the_option_factory/returns_a_null_option.cs @@ -50,7 +50,7 @@ public class returns_a_null_option : SettingUpALongOptionTestContext Because of = () => SetupOptionWith(valid_short_name, valid_long_name); - It should_throw_an_error = () => error.ShouldBeOfType(typeof(InvalidOperationException)); + It should_throw_an_error = () => error.ShouldBeOfExactType(typeof(InvalidOperationException)); It should_not_have_setup_an_option = () => sut.Options.ShouldBeEmpty(); } } diff --git a/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/and_the_option_factory/throws_an_error.cs b/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/and_the_option_factory/throws_an_error.cs index 566fe24..7825d80 100644 --- a/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/and_the_option_factory/throws_an_error.cs +++ b/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/and_the_option_factory/throws_an_error.cs @@ -49,7 +49,7 @@ public class throws_an_error : SettingUpALongOptionTestContext Because of = () => SetupOptionWith(valid_short_name, valid_long_name); - It should_throw_an_error = () => error.ShouldBeOfType(typeof(TestException)); + It should_throw_an_error = () => error.ShouldBeOfExactType(typeof(TestException)); It should_not_have_setup_an_option = () => sut.Options.ShouldBeEmpty(); } } diff --git a/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/with_a_long_name/with_a_long_name_that_is_already_used.cs b/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/with_a_long_name/with_a_long_name_that_is_already_used.cs index ac81320..c52d497 100644 --- a/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/with_a_long_name/with_a_long_name_that_is_already_used.cs +++ b/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/with_a_long_name/with_a_long_name_that_is_already_used.cs @@ -53,7 +53,7 @@ public class with_a_long_name_that_is_already_used : SettingUpALongOptionTestCon SetupOptionWith(valid_short_name, existingLongName); }; - It should_throw_an_error = () => error.ShouldBeOfType(typeof(OptionAlreadyExistsException)); + It should_throw_an_error = () => error.ShouldBeOfExactType(typeof(OptionAlreadyExistsException)); It should_not_have_setup_an_option = () => sut.Options.ShouldContainOnly(existingOption); } } diff --git a/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/with_a_short_name/with_a_short_name_that_is_already_used.cs b/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/with_a_short_name/with_a_short_name_that_is_already_used.cs index d8b9d4d..c750226 100644 --- a/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/with_a_short_name/with_a_short_name_that_is_already_used.cs +++ b/FluentCommandLineParser.Tests/FluentCommandLineParser/when_setting_up_a_new_option/with_a_short_name/with_a_short_name_that_is_already_used.cs @@ -53,7 +53,7 @@ public class with_a_short_name_that_is_already_used : SettingUpAShortOptionTestC SetupOptionWith(existingShortName); }; - It should_throw_an_error = () => error.ShouldBeOfType(typeof(OptionAlreadyExistsException)); + It should_throw_an_error = () => error.ShouldBeOfExactType(typeof(OptionAlreadyExistsException)); It should_not_have_setup_an_option = () => sut.Options.ShouldContainOnly(existingOption); } } diff --git a/FluentCommandLineParser.Tests/FluentCommandLineParser/when_using_an_option_factory/that_has_been_set_to_null.cs b/FluentCommandLineParser.Tests/FluentCommandLineParser/when_using_an_option_factory/that_has_been_set_to_null.cs index 40aa36a..067c6e5 100644 --- a/FluentCommandLineParser.Tests/FluentCommandLineParser/when_using_an_option_factory/that_has_been_set_to_null.cs +++ b/FluentCommandLineParser.Tests/FluentCommandLineParser/when_using_an_option_factory/that_has_been_set_to_null.cs @@ -35,7 +35,7 @@ public class that_has_been_set_to_null : FluentCommandLineParserTestContext Because of = () => sut.OptionFactory = null; It should_be_unable_to_assign_to_null = () => sut.OptionFactory.ShouldNotBeNull(); - It should_use_the_default_one_instead = () => sut.OptionFactory.ShouldBeOfType(typeof(CommandLineOptionFactory)); + It should_use_the_default_one_instead = () => sut.OptionFactory.ShouldBeOfExactType(typeof(CommandLineOptionFactory)); } } } \ No newline at end of file diff --git a/FluentCommandLineParser.Tests/FluentCommandLineParserBuilderTests.cs b/FluentCommandLineParser.Tests/FluentCommandLineParserBuilderTests.cs index 4aa78bf..15f4fe9 100644 --- a/FluentCommandLineParser.Tests/FluentCommandLineParserBuilderTests.cs +++ b/FluentCommandLineParser.Tests/FluentCommandLineParserBuilderTests.cs @@ -45,8 +45,8 @@ class when_initialised : FluentCommandLineParserBuilderTestContext It should_enable_case_sensitive = () => sut.IsCaseSensitive.ShouldBeTrue(); - It should_have_the_fluent_parser_by_default = () => - sut.Parser.ShouldBeOfType(); + private It should_have_the_fluent_parser_by_default = () => + sut.Parser.ShouldBeAssignableTo(); It should_have_initialised_the_object = () => sut.Object.ShouldNotBeNull(); diff --git a/FluentCommandLineParser.Tests/FluentCommandLineParserMSpecTests.cs b/FluentCommandLineParser.Tests/FluentCommandLineParserMSpecTests.cs index 152bccc..ba6b90d 100644 --- a/FluentCommandLineParser.Tests/FluentCommandLineParserMSpecTests.cs +++ b/FluentCommandLineParser.Tests/FluentCommandLineParserMSpecTests.cs @@ -76,8 +76,8 @@ class when_enabled : IsCaseSensitiveTestContext It should_return_enabled = () => sut.IsCaseSensitive.ShouldBeTrue(); - It should_set_the_comparison_type_to_case_sensitive = () => - sut.StringComparison.ShouldEqual(Fclp.FluentCommandLineParser.CaseSensitiveComparison); +// It should_set_the_comparison_type_to_case_sensitive = () => +// sut.StringComparison.ShouldEqual(Fclp.FluentCommandLineParser.CaseSensitiveComparison); } class when_disabled : IsCaseSensitiveTestContext @@ -87,8 +87,8 @@ class when_disabled : IsCaseSensitiveTestContext It should_return_disabled = () => sut.IsCaseSensitive.ShouldBeFalse(); - It should_set_the_comparison_type_to_ignore_case = () => - sut.StringComparison.ShouldEqual(Fclp.FluentCommandLineParser.IgnoreCaseComparison); +// It should_set_the_comparison_type_to_ignore_case = () => +// sut.StringComparison.ShouldEqual(Fclp.FluentCommandLineParser.IgnoreCaseComparison); } } } diff --git a/FluentCommandLineParser.Tests/FluentCommandLineParserTests.cs b/FluentCommandLineParser.Tests/FluentCommandLineParserTests.cs index 6854ae6..edba338 100644 --- a/FluentCommandLineParser.Tests/FluentCommandLineParserTests.cs +++ b/FluentCommandLineParser.Tests/FluentCommandLineParserTests.cs @@ -30,14 +30,13 @@ using Fclp.Internals.Errors; using Fclp.Tests.FluentCommandLineParser; using Moq; -using NUnit.Framework; +using Xunit; namespace Fclp.Tests { /// /// Contains unit tests for the class. /// - [TestFixture] public class FluentCommandLineParserTests { #region HelperMethods @@ -88,9 +87,9 @@ static void RunTest(string value, T expected) var assert = new Action((args, result) => { string msg = FormatArgs(args); - Assert.AreEqual(expected, actual, msg); - Assert.IsFalse(result.HasErrors, msg); - Assert.IsFalse(result.Errors.Any(), msg); + Assert.Equal(expected, actual); //, msg); + Assert.False(result.HasErrors, msg); + Assert.False(result.Errors.Any(), msg); }); CallParserWithAllKeyVariations(parser, "short", value, assert); @@ -101,7 +100,7 @@ static void RunTest(string value, T expected) #region Description Tests - [Test] + [Fact] public void Ensure_Description_Can_Be_Set() { var parser = CreateFluentParser(); @@ -112,7 +111,7 @@ public void Ensure_Description_Can_Be_Set() var actual = ((ICommandLineOption)cmdOption).Description; - Assert.AreSame(expected, actual); + Assert.Same(expected, actual); } #endregion Description Tests @@ -121,14 +120,14 @@ public void Ensure_Description_Can_Be_Set() #region String Option - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_String_When_Using_Short_option() { const string expected = "my-expected-string"; RunTest(expected, expected); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_String_When_Using_Long_option() { const string expected = "my-expected-string"; @@ -144,9 +143,9 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_String_When_Using_Lon CallParserWithAllKeyVariations(parser, key, expected, (args, result) => { string msg = "Executed with args: " + FormatArgs(args); - Assert.AreEqual(expected, actual, msg); - Assert.IsFalse(result.HasErrors, msg); - Assert.IsFalse(result.Errors.Any(), msg); + Assert.Equal(expected, actual); //, msg); + Assert.False(result.HasErrors, msg); + Assert.False(result.Errors.Any(), msg); }); } @@ -154,7 +153,7 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_String_When_Using_Lon #region Int32 Option - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Int32_When_Using_Short_option() { const int expected = int.MaxValue; @@ -171,13 +170,13 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Int32_When_Using_Shor //CallParserWithAllKeyVariations(parser, shortKey, expected.ToString(CultureInfo.InvariantCulture), (args, result) => //{ // string msg = "Executed with args: " + FormatArgs(args); - // Assert.AreEqual(expected, actual, msg); - // Assert.IsFalse(result.HasErrors, msg); - // Assert.IsFalse(result.Errors.Any(), msg); + // Assert.Equal(expected, actual, msg); + // Assert.False(result.HasErrors, msg); + // Assert.False(result.Errors.Any(), msg); //}); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Int32_When_Using_Long_option() { const int expected = int.MaxValue; @@ -194,13 +193,13 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Int32_When_Using_Long CallParserWithAllKeyVariations(parser, longKey, expected.ToString(CultureInfo.InvariantCulture), (args, result) => { string msg = "Executed with args: " + FormatArgs(args); - Assert.AreEqual(expected, actual, msg); - Assert.IsFalse(result.HasErrors, msg); - Assert.IsFalse(result.Errors.Any(), msg); + Assert.Equal(expected, actual); //, msg); + Assert.False(result.HasErrors, msg); + Assert.False(result.Errors.Any(), msg); }); } - [Test] + [Fact] public void Ensure_Negative_Integer_Can_Be_Specified_With_Unix_Style() { var parser = CreateFluentParser(); @@ -212,18 +211,18 @@ public void Ensure_Negative_Integer_Can_Be_Specified_With_Unix_Style() var result = parser.Parse(new[] { "--integer", "--", "-123" }); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.EmptyArgs); - Assert.IsFalse(result.HelpCalled); + Assert.False(result.HasErrors); + Assert.False(result.EmptyArgs); + Assert.False(result.HelpCalled); - Assert.AreEqual(-123, actual); + Assert.Equal(-123, actual); } #endregion Int32 Option #region Double Option - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Double_When_Using_Short_option() { const double expected = 1.23456789d; @@ -239,13 +238,13 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Double_When_Using_Sho //CallParserWithAllKeyVariations(parser, shortKey, expected.ToString(CultureInfo.InvariantCulture), (args, result) => //{ - // Assert.AreEqual(expected, actual, FormatArgs(args)); - // Assert.IsFalse(result.HasErrors, FormatArgs(args)); - // Assert.IsFalse(result.Errors.Any(), FormatArgs(args)); + // Assert.Equal(expected, actual, FormatArgs(args)); + // Assert.False(result.HasErrors, FormatArgs(args)); + // Assert.False(result.Errors.Any(), FormatArgs(args)); //}); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Double_When_Using_Long_option() { const double expected = 1.23456789d; @@ -261,13 +260,13 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Double_When_Using_Lon CallParserWithAllKeyVariations(parser, longKey, expected.ToString(CultureInfo.InvariantCulture), (args, result) => { - Assert.AreEqual(expected, actual, FormatArgs(args)); - Assert.IsFalse(result.HasErrors, FormatArgs(args)); - Assert.IsFalse(result.Errors.Any(), FormatArgs(args)); + Assert.Equal(expected, actual); //, FormatArgs(args)); + Assert.False(result.HasErrors, FormatArgs(args)); + Assert.False(result.Errors.Any(), FormatArgs(args)); }); } - [Test] + [Fact] public void Ensure_Negative_Double_Can_Be_Specified_With_Unix_Style() { var parser = CreateFluentParser(); @@ -279,18 +278,18 @@ public void Ensure_Negative_Double_Can_Be_Specified_With_Unix_Style() var result = parser.Parse(new[] { "--double", "--", "-123.456" }); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.EmptyArgs); - Assert.IsFalse(result.HelpCalled); + Assert.False(result.HasErrors); + Assert.False(result.EmptyArgs); + Assert.False(result.HelpCalled); - Assert.AreEqual(-123.456, actual); + Assert.Equal(-123.456, actual); } #endregion Double Option #region Enum Option - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Short_option() { const TestEnum expected = TestEnum.Value1; @@ -305,10 +304,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Short parser.Parse(new[] { "-e", expected.ToString() }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Long_option() { const TestEnum expected = TestEnum.Value1; @@ -323,10 +322,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Long_ parser.Parse(new[] { "--enum", expected.ToString() }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Short_option_And_Int32_Enum() { const TestEnum expected = TestEnum.Value1; @@ -341,10 +340,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Short parser.Parse(new[] { "-e", ((int)expected).ToString(CultureInfo.InvariantCulture) }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Long_option_And_Int32_Enum() { const TestEnum expected = TestEnum.Value1; @@ -359,10 +358,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Long_ parser.Parse(new[] { "--enum", ((int)expected).ToString(CultureInfo.InvariantCulture) }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Short_option_And_Lowercase_String() { const TestEnum expected = TestEnum.Value1; @@ -377,10 +376,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Short parser.Parse(new[] { "-e", expected.ToString().ToLowerInvariant() }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Long_option_And_Int32_Enum_And_Lowercase_String() { const TestEnum expected = TestEnum.Value1; @@ -395,10 +394,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Long_ parser.Parse(new[] { "--enum", expected.ToString().ToLowerInvariant() }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Short_option_And_Uppercase_String() { const TestEnum expected = TestEnum.Value1; @@ -413,10 +412,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Short parser.Parse(new[] { "-e", expected.ToString().ToUpperInvariant() }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Long_option_And_Int32_Enum_And_Uppercase_String() { const TestEnum expected = TestEnum.Value1; @@ -431,12 +430,12 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Enum_When_Using_Long_ parser.Parse(new[] { "--enum", expected.ToString().ToUpperInvariant() }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } #region Enum Flags Option - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_EnumFlag_When_Using_Short_option() { const TestEnumFlag expected = TestEnumFlag.Value1; @@ -451,10 +450,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_EnumFlag_When_Using_S parser.Parse(new[] { "-e", expected.ToString() }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_EnumFlag_When_Using_Short_option_And_A_List() { var actual = TestEnumFlag.Value0; @@ -467,13 +466,13 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_EnumFlag_When_Using_S parser.Parse(new[] { "-e", TestEnumFlag.Value1.ToString(), TestEnumFlag.Value2.ToString() }); - Assert.AreEqual(3, (int)actual); - Assert.IsTrue(actual.HasFlag(TestEnumFlag.Value1)); - Assert.IsTrue(actual.HasFlag(TestEnumFlag.Value2)); - Assert.IsFalse(actual.HasFlag(TestEnumFlag.Value64)); + Assert.Equal(3, (int)actual); + Assert.True(actual.HasFlag(TestEnumFlag.Value1)); + Assert.True(actual.HasFlag(TestEnumFlag.Value2)); + Assert.False(actual.HasFlag(TestEnumFlag.Value64)); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_EnumFlag_When_Using_Short_option_And_A_List_With_0() { var actual = TestEnumFlag.Value0; @@ -486,16 +485,16 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_EnumFlag_When_Using_S parser.Parse(new[] { "-e", TestEnumFlag.Value1.ToString(), TestEnumFlag.Value2.ToString(), TestEnumFlag.Value0.ToString(), TestEnumFlag.Value64.ToString() }); - Assert.AreEqual(67, (int)actual); - Assert.IsTrue(actual.HasFlag(TestEnumFlag.Value1)); - Assert.IsTrue(actual.HasFlag(TestEnumFlag.Value2)); - Assert.IsTrue(actual.HasFlag(TestEnumFlag.Value64)); - Assert.IsTrue(actual.HasFlag(TestEnumFlag.Value0)); - Assert.IsFalse(actual.HasFlag(TestEnumFlag.Value8)); - Assert.IsFalse(actual.HasFlag(TestEnumFlag.Value32)); + Assert.Equal(67, (int)actual); + Assert.True(actual.HasFlag(TestEnumFlag.Value1)); + Assert.True(actual.HasFlag(TestEnumFlag.Value2)); + Assert.True(actual.HasFlag(TestEnumFlag.Value64)); + Assert.True(actual.HasFlag(TestEnumFlag.Value0)); + Assert.False(actual.HasFlag(TestEnumFlag.Value8)); + Assert.False(actual.HasFlag(TestEnumFlag.Value32)); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_EnumFlag_When_Using_Short_option_And_A_List_Of_String_Values() { var args = new[] { "--direction", "South", "East" }; @@ -509,10 +508,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_EnumFlag_When_Using_S p.Parse(args); - Assert.IsFalse(actual.HasFlag(Direction.North)); - Assert.IsTrue(actual.HasFlag(Direction.East)); - Assert.IsTrue(actual.HasFlag(Direction.South)); - Assert.IsFalse(actual.HasFlag(Direction.West)); + Assert.False(actual.HasFlag(Direction.North)); + Assert.True(actual.HasFlag(Direction.East)); + Assert.True(actual.HasFlag(Direction.South)); + Assert.False(actual.HasFlag(Direction.West)); } [Flags] @@ -530,7 +529,7 @@ public enum Direction #region Enum? Options - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Null_When_No_Value_Provided() { TestEnum? actual = TestEnum.Value0; @@ -543,10 +542,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Null_When_No_Value_Provided() parser.Parse(new[] { "-e" }); - Assert.IsNull(actual); + Assert.Null(actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Using_Short_option() { TestEnum? expected = TestEnum.Value1; @@ -561,10 +560,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Us parser.Parse(new[] { "-e", expected.ToString() }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Using_Long_option() { TestEnum? expected = TestEnum.Value1; @@ -579,10 +578,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Us parser.Parse(new[] { "--enum", expected.ToString() }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Using_Short_option_And_Int32_Enum() { TestEnum? expected = TestEnum.Value1; @@ -597,10 +596,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Us parser.Parse(new[] { "-e", ((int)expected).ToString(CultureInfo.InvariantCulture) }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Using_Long_option_And_Int32_Enum() { TestEnum? expected = TestEnum.Value1; @@ -615,10 +614,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Us parser.Parse(new[] { "--enum", ((int)expected).ToString(CultureInfo.InvariantCulture) }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Using_Short_option_And_Lowercase_String() { TestEnum? expected = TestEnum.Value1; @@ -633,10 +632,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Us parser.Parse(new[] { "-e", expected.ToString().ToLowerInvariant() }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Using_Long_option_And_Int32_Enum_And_Lowercase_String() { TestEnum? expected = TestEnum.Value1; @@ -651,10 +650,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Us parser.Parse(new[] { "--enum", expected.ToString().ToLowerInvariant() }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Using_Short_option_And_Uppercase_String() { TestEnum? expected = TestEnum.Value1; @@ -669,10 +668,10 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Us parser.Parse(new[] { "-e", expected.ToString().ToUpperInvariant() }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Using_Long_option_And_Int32_Enum_And_Uppercase_String() { TestEnum? expected = TestEnum.Value1; @@ -687,14 +686,14 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Enum_When_Us parser.Parse(new[] { "--enum", expected.ToString().ToUpperInvariant() }); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } #endregion #region DateTime Option - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_DateTime_When_Using_Short_option() { var expected = new DateTime(2012, 2, 29, 01, 01, 01); @@ -709,12 +708,12 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_DateTime_When_Using_S //var result = parser.Parse(new[] { "-dt", expected.ToString("yyyy-MM-ddThh:mm:ss", CultureInfo.CurrentCulture) }); - //Assert.AreEqual(expected, actual); - //Assert.IsFalse(result.HasErrors); - //Assert.IsFalse(result.Errors.Any()); + //Assert.Equal(expected, actual); + //Assert.False(result.HasErrors); + //Assert.False(result.Errors.Any()); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_DateTime_When_Using_Long_option() { var expected = new DateTime(2012, 2, 29, 01, 01, 01); @@ -729,12 +728,12 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_DateTime_When_Using_L var result = parser.Parse(new[] { "--datetime", expected.ToString("yyyy-MM-ddThh:mm:ss", CultureInfo.CurrentCulture) }); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_DateTime_When_Using_Spaces_And_Long_option() { var expected = new DateTime(2012, 2, 29, 01, 01, 01); @@ -749,19 +748,19 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_DateTime_When_Using_S var result = parser.Parse(new[] { "--datetime", expected.ToString("yyyy MM dd hh:mm:ss tt", CultureInfo.CurrentCulture) }); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_DateTime_When_Using_Spaces_And_Short_option() { var expected = new DateTime(2012, 2, 29, 01, 01, 01); RunTest(expected.ToString("yyyy MM dd hh:mm:ss tt", CultureInfo.CurrentCulture), expected); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_ListDateTime_When_Using_Spaces_And_Long_option() { var expected = new List { @@ -782,16 +781,16 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_ListDateTime_When_Usi dArgs.AddRange(expected.Select(x => "\"" + x.ToString("yyyy MM dd hh:mm:ss tt", CultureInfo.CurrentCulture) + "\"")); var result = parser.Parse(dArgs.ToArray()); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } #endregion DateTime Option #region int? Option - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Int32_When_Valid_Value_Is_Provided() { int? expected = 1; @@ -804,12 +803,12 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Int32_When_V var result = parser.Parse(new[] {"--integer", "1"}); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Int32_When_InValid_Value_Is_Provided() { int? expected = null; @@ -822,12 +821,12 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Int32_When_I var result = parser.Parse(new[] {"--integer", "abc"}); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Int32_When_Null_Is_Provided() { int? expected = null; @@ -840,16 +839,16 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Int32_When_N var result = parser.Parse(new[] {"--integer"} ); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } #endregion #region double? Option - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Double_When_Valid_Value_Is_Provided() { double? expected = 1.23456789d; @@ -862,12 +861,12 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Double_When_ var result = parser.Parse(new[] { "--double", expected.Value.ToString(CultureInfo.CurrentCulture) }); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Double_When_InValid_Value_Is_Provided() { double? expected = null; @@ -880,12 +879,12 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Double_When_ var result = parser.Parse(new[] { "--double", "not-a-double" }); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Double_When_No_Value_Is_Provided() { double? expected = null; @@ -898,16 +897,16 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Double_When_ var result = parser.Parse(new[] { "--double" }); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } #endregion #region DateTime? Option - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_DateTime_When_Valid_Value_Is_Provided() { DateTime? expected = new DateTime(2012, 2, 29, 01, 01, 01); @@ -921,12 +920,12 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_DateTime_Whe var result = parser.Parse(new[] { "--datetime", expected.Value.ToString("yyyy-MM-ddThh:mm:ss", CultureInfo.CurrentCulture) }); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_DateTime_When_InValid_Value_Is_Provided() { DateTime? expected = null; @@ -940,12 +939,12 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_DateTime_Whe var result = parser.Parse(new[] { "--datetime", "not-a-date-time" }); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_DateTime_When_No_Value_Is_Provided() { DateTime? expected = null; @@ -959,16 +958,16 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_DateTime_Whe var result = parser.Parse(new[] { "--datetime" }); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } #endregion #region bool? Option - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Bool_When_Valid_Value_Is_Provided() { bool? expected = true; @@ -981,12 +980,12 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Bool_When_Va var result = parser.Parse(new[] { "--bool", "true" }); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Bool_When_InValid_Value_Is_Provided() { bool? expected = null; @@ -999,12 +998,12 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Bool_When_In var result = parser.Parse(new[] { "--bool", "not-a-bool" }); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Bool_When_No_Value_Is_Provided() { bool? expected = null; @@ -1017,16 +1016,16 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Nullable_Bool_When_No var result = parser.Parse(new[] { "--bool" }); - Assert.AreEqual(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } #endregion #region Uri Option - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Uri_When_Valid_Value_Is_Provided() { const string expected = "https://github.com/fclp/fluent-command-line-parser"; @@ -1039,12 +1038,12 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Uri_When_Valid_Value_ var result = parser.Parse(new[] { "--uri", expected }); - Assert.AreEqual(expected, actual.AbsoluteUri); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Equal(expected, actual.AbsoluteUri); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Uri_When_InValid_Value_Is_Provided() { Uri actual = null; @@ -1056,12 +1055,12 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Uri_When_InValid_Valu var result = parser.Parse(new[] { "--uri", "not-a-uri" }); - Assert.IsNull(actual); - Assert.IsTrue(result.HasErrors); - Assert.AreEqual(result.Errors.Count(), 1); + Assert.Null(actual); + Assert.True(result.HasErrors); + Assert.Equal(result.Errors.Count(), 1); } - [Test] + [Fact] public void Ensure_Parser_Calls_The_Callback_With_Expected_Uri_When_No_Value_Is_Provided() { Uri actual = null; @@ -1073,16 +1072,16 @@ public void Ensure_Parser_Calls_The_Callback_With_Expected_Uri_When_No_Value_Is_ var result = parser.Parse(new[] { "--uri" }); - Assert.IsNull(actual); - Assert.IsTrue(result.HasErrors); - Assert.AreEqual(result.Errors.Count(), 1); + Assert.Null(actual); + Assert.True(result.HasErrors); + Assert.Equal(result.Errors.Count(), 1); } #endregion #region Long Option Only - [Test] + [Fact] public void Can_have_long_option_only() { var parser = CreateFluentParser(); @@ -1093,26 +1092,25 @@ public void Can_have_long_option_only() var result = parser.Parse(new[] { "--my-feature", "somevalue" }); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.EmptyArgs); - Assert.IsFalse(result.HelpCalled); + Assert.False(result.HasErrors); + Assert.False(result.EmptyArgs); + Assert.False(result.HelpCalled); - Assert.AreEqual("somevalue", s); + Assert.Equal("somevalue", s); } - [Test] - [ExpectedException(typeof(InvalidOptionNameException))] + [Fact] public void Cannot_have_single_character_long_option() { var parser = CreateFluentParser(); - parser.Setup("s"); + Assert.Throws(() => parser.Setup("s")); } #endregion #region Required - [Test] + [Fact] public void Ensure_Expected_Error_Is_Returned_If_A_Option_Is_Required_And_Null_Args_Are_Specified() { var parser = CreateFluentParser(); @@ -1122,14 +1120,14 @@ public void Ensure_Expected_Error_Is_Returned_If_A_Option_Is_Required_And_Null_A var result = parser.Parse(null); - Assert.IsTrue(result.HasErrors); + Assert.True(result.HasErrors); - Assert.AreEqual(1, result.Errors.Count()); + Assert.Equal(1, result.Errors.Count()); - Assert.IsInstanceOf(typeof(ExpectedOptionNotFoundParseError), result.Errors.First()); + Assert.IsType(typeof(ExpectedOptionNotFoundParseError), result.Errors.First()); } - [Test] + [Fact] public void Ensure_Expected_Error_Is_Returned_If_A_Option_Is_Required_And_Empty_Args_Are_Specified() { var parser = CreateFluentParser(); @@ -1139,14 +1137,14 @@ public void Ensure_Expected_Error_Is_Returned_If_A_Option_Is_Required_And_Empty_ var result = parser.Parse(new string[0]); - Assert.IsTrue(result.HasErrors); + Assert.True(result.HasErrors); - Assert.AreEqual(1, result.Errors.Count()); + Assert.Equal(1, result.Errors.Count()); - Assert.IsInstanceOf(typeof(ExpectedOptionNotFoundParseError), result.Errors.First()); + Assert.IsType(typeof(ExpectedOptionNotFoundParseError), result.Errors.First()); } - [Test] + [Fact] public void Ensure_Expected_Error_Is_Returned_If_Required_Option_Is_Provided() { var parser = CreateFluentParser(); @@ -1156,14 +1154,14 @@ public void Ensure_Expected_Error_Is_Returned_If_Required_Option_Is_Provided() var result = parser.Parse(new[] { "-d" }); - Assert.IsTrue(result.HasErrors); + Assert.True(result.HasErrors); - Assert.AreEqual(1, result.Errors.Count()); + Assert.Equal(1, result.Errors.Count()); - Assert.IsInstanceOf(typeof(ExpectedOptionNotFoundParseError), result.Errors.First()); + Assert.IsType(typeof(ExpectedOptionNotFoundParseError), result.Errors.First()); } - [Test] + [Fact] public void Ensure_No_Error_Returned_If_Required_Option_Is_Not_Provided() { var parser = CreateFluentParser(); @@ -1172,48 +1170,45 @@ public void Ensure_No_Error_Returned_If_Required_Option_Is_Not_Provided() var result = parser.Parse(new[] { "-d" }); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } - [Test] - [ExpectedException(typeof(OptionAlreadyExistsException))] + [Fact] public void Ensure_Expected_Exception_Thrown_If_Adding_A_Option_With_A_ShortName_Which_Has_Already_Been_Setup() { var parser = CreateFluentParser(); parser.Setup('s', "string"); - parser.Setup('s', "int32"); + Assert.Throws(() => parser.Setup('s', "int32")); } - [Test] - [ExpectedException(typeof(OptionAlreadyExistsException))] + [Fact] public void Ensure_Expected_Exception_Thrown_If_Adding_A_Option_With_A_ShortName_And_LongName_Which_Has_Already_Been_Setup() { var parser = CreateFluentParser(); parser.Setup('s', "string"); - parser.Setup('s', "string"); + Assert.Throws(() => parser.Setup('s', "string")); } - [Test] - [ExpectedException(typeof(OptionAlreadyExistsException))] + [Fact] public void Ensure_Expected_Exception_Thrown_If_Adding_A_Option_With_A_LongName_Which_Has_Already_Been_Setup() { var parser = CreateFluentParser(); parser.Setup('s', "string"); - parser.Setup('i', "string"); + Assert.Throws(() => parser.Setup('i', "string")); } #endregion #region Default - [Test] + [Fact] public void Ensure_Default_Value_Returned_If_No_Value_Specified() { var parser = CreateFluentParser(); @@ -1227,11 +1222,11 @@ public void Ensure_Default_Value_Returned_If_No_Value_Specified() var result = parser.Parse(new[] { "-s" }); - Assert.AreSame(expected, actual); - Assert.IsTrue(result.HasErrors); + Assert.Same(expected, actual); + Assert.True(result.HasErrors); } - [Test] + [Fact] public void Ensure_Default_Value_Returned_If_No_Option_Or_Value_Specified() { var parser = CreateFluentParser(); @@ -1245,40 +1240,40 @@ public void Ensure_Default_Value_Returned_If_No_Option_Or_Value_Specified() var result = parser.Parse(new string[0]); - Assert.AreSame(expected, actual); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.Same(expected, actual); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); } #endregion #region No Args - [Test] + [Fact] public void Ensure_Can_Specify_Empty_Args() { var parser = CreateFluentParser(); var result = parser.Parse(new string[0]); - Assert.IsFalse(result.HasErrors); - Assert.IsTrue(result.EmptyArgs); - Assert.IsFalse(result.Errors.Any()); + Assert.False(result.HasErrors); + Assert.True(result.EmptyArgs); + Assert.False(result.Errors.Any()); } - [Test] + [Fact] public void Ensure_Can_Specify_Null_Args() { var parser = CreateFluentParser(); var result = parser.Parse(null); - Assert.IsFalse(result.HasErrors); - Assert.IsTrue(result.EmptyArgs); - Assert.IsFalse(result.Errors.Any()); + Assert.False(result.HasErrors); + Assert.True(result.EmptyArgs); + Assert.False(result.Errors.Any()); } - [Test] + [Fact] public void Ensure_Defaults_Are_Called_When_Empty_Args_Specified() { var parser = CreateFluentParser(); @@ -1300,19 +1295,19 @@ public void Ensure_Defaults_Are_Called_When_Empty_Args_Specified() var result = parser.Parse(null); - Assert.IsFalse(result.HasErrors); - Assert.IsTrue(result.EmptyArgs); - Assert.AreEqual(expectedInt, actualInt); - Assert.AreEqual(expectedDouble, actualDouble); - Assert.AreEqual(expectedString, actualString); - Assert.AreEqual(expectedBool, actualBool); + Assert.False(result.HasErrors); + Assert.True(result.EmptyArgs); + Assert.Equal(expectedInt, actualInt); + Assert.Equal(expectedDouble, actualDouble); + Assert.Equal(expectedString, actualString); + Assert.Equal(expectedBool, actualBool); } #endregion No Args #region Example - [Test] + [Fact] public void Ensure_Example_Works_As_Expected() { const int expectedRecordId = 10; @@ -1362,22 +1357,22 @@ public void Ensure_Example_Works_As_Expected() // do the work ICommandLineParserResult result = parser.Parse(args); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.Errors.Any()); + Assert.False(result.HasErrors); + Assert.False(result.Errors.Any()); - Assert.AreEqual(expectedRecordId, recordId); - Assert.AreEqual(expectedValue, newValue); - Assert.AreEqual(expectedSilentMode, inSilentMode); - Assert.AreEqual(expectedSwitchA, switchA); - Assert.AreEqual(expectedSwitchB, switchB); - Assert.AreEqual(expectedSwitchC, switchC); + Assert.Equal(expectedRecordId, recordId); + Assert.Equal(expectedValue, newValue); + Assert.Equal(expectedSilentMode, inSilentMode); + Assert.Equal(expectedSwitchA, switchA); + Assert.Equal(expectedSwitchB, switchB); + Assert.Equal(expectedSwitchC, switchC); } #endregion #region Setup Help - [Test] + [Fact] public void Setup_Help_And_Ensure_It_Is_Called_With_Custom_Formatter() { var parser = new Fclp.FluentCommandLineParser(); @@ -1401,12 +1396,12 @@ public void Setup_Help_And_Ensure_It_Is_Called_With_Custom_Formatter() var result = parser.Parse(args); - Assert.AreSame(expectedCallbackResult, callbackResult); - Assert.IsFalse(result.HasErrors); - Assert.IsTrue(result.HelpCalled); + Assert.Same(expectedCallbackResult, callbackResult); + Assert.False(result.HasErrors); + Assert.True(result.HelpCalled); } - [Test] + [Fact] public void Setup_Help_And_Ensure_It_Is_Called() { var parser = new Fclp.FluentCommandLineParser(); @@ -1429,12 +1424,12 @@ public void Setup_Help_And_Ensure_It_Is_Called() var result = parser.Parse(args); - Assert.IsTrue(wasCalled); - Assert.IsFalse(result.HasErrors); - Assert.IsTrue(result.HelpCalled); + Assert.True(wasCalled); + Assert.False(result.HasErrors); + Assert.True(result.HelpCalled); } - [Test] + [Fact] public void Setup_Help_With_Symbol() { var parser = CreateFluentParser(); @@ -1447,11 +1442,11 @@ public void Setup_Help_With_Symbol() var result = parser.Parse(args); - Assert.IsTrue(result.HelpCalled); - Assert.IsNotNullOrEmpty(callbackResult); + Assert.True(result.HelpCalled); + Assert.NotEmpty(callbackResult); } - [Test] + [Fact] public void Setup_Help_And_Ensure_It_Can_Be_Called_Manually() { var parser = CreateFluentParser(); @@ -1462,10 +1457,10 @@ public void Setup_Help_And_Ensure_It_Can_Be_Called_Manually() parser.HelpOption.ShowHelp(parser.Options); - Assert.IsNotNullOrEmpty(callbackResult); + Assert.NotEmpty(callbackResult); } - [Test] + [Fact] public void Generic_Setup_Help_And_Ensure_It_Can_Be_Called_Manually() { var parser = new FluentCommandLineParser(); @@ -1476,14 +1471,14 @@ public void Generic_Setup_Help_And_Ensure_It_Can_Be_Called_Manually() parser.HelpOption.ShowHelp(parser.Options); - Assert.IsNotNullOrEmpty(callbackResult); + Assert.NotEmpty(callbackResult); } #endregion #region Case Sensitive - [Test] + [Fact] public void Ensure_Short_Options_Are_Case_Sensitive_When_Enabled() { var parser = CreateFluentParser(); @@ -1501,12 +1496,12 @@ public void Ensure_Short_Options_Are_Case_Sensitive_When_Enabled() var result = parser.Parse(new[] { "-S", expectedUpperCaseValue, "-s", expectedLowerCaseValue }); - Assert.IsFalse(result.HasErrors); - Assert.AreEqual(expectedUpperCaseValue, upperCaseValue); - Assert.AreEqual(expectedLowerCaseValue, lowerCaseValue); + Assert.False(result.HasErrors); + Assert.Equal(expectedUpperCaseValue, upperCaseValue); + Assert.Equal(expectedLowerCaseValue, lowerCaseValue); } - [Test] + [Fact] public void Ensure_Long_Options_Are_Case_Sensitive_When_Enabled() { var parser = CreateFluentParser(); @@ -1524,12 +1519,12 @@ public void Ensure_Long_Options_Are_Case_Sensitive_When_Enabled() var result = parser.Parse(new[] { "--LONGOPTION", expectedUpperCaseValue, "--longoption", expectedLowerCaseValue }); - Assert.IsFalse(result.HasErrors); - Assert.AreEqual(expectedUpperCaseValue, upperCaseValue); - Assert.AreEqual(expectedLowerCaseValue, lowerCaseValue); + Assert.False(result.HasErrors); + Assert.Equal(expectedUpperCaseValue, upperCaseValue); + Assert.Equal(expectedLowerCaseValue, lowerCaseValue); } - [Test] + [Fact] public void Ensure_Short_Options_Ignore_Case_When_Disabled() { var parser = CreateFluentParser(); @@ -1544,11 +1539,11 @@ public void Ensure_Short_Options_Ignore_Case_When_Disabled() var result = parser.Parse(new[] { "--S", expectedValue }); - Assert.IsFalse(result.HasErrors); - Assert.AreEqual(expectedValue, actualValue); + Assert.False(result.HasErrors); + Assert.Equal(expectedValue, actualValue); } - [Test] + [Fact] public void Ensure_Long_Options_Ignore_Case_When_Disabled() { var parser = CreateFluentParser(); @@ -1563,81 +1558,77 @@ public void Ensure_Long_Options_Ignore_Case_When_Disabled() var result = parser.Parse(new[] { "--LONGOPTION", expectedValue }); - Assert.IsFalse(result.HasErrors); - Assert.AreEqual(expectedValue, actualValue); + Assert.False(result.HasErrors); + Assert.Equal(expectedValue, actualValue); } #endregion #region Obsolete - [Test] + [Fact] public void Ensure_Obsolete_Setup_With_Only_Short_Option() { var parser = CreateFluentParser(); parser.Setup("s", null); var option = parser.Options.Single(); - Assert.IsNull(option.LongName); - Assert.AreEqual("s", option.ShortName); + Assert.Null(option.LongName); + Assert.Equal("s", option.ShortName); } - [Test] + [Fact] public void Ensure_Obsolete_Setup_With_Only_Long_Option() { var parser = CreateFluentParser(); parser.Setup(null, "long"); var option = parser.Options.Single(); - Assert.AreEqual("long", option.LongName); - Assert.IsNull(option.ShortName); + Assert.Equal("long", option.LongName); + Assert.Null(option.ShortName); } - [Test] + [Fact] public void Ensure_Obsolete_Setup_With_Short_And_Long_Option() { var parser = CreateFluentParser(); parser.Setup("s", "long"); var option = parser.Options.Single(); - Assert.AreEqual("long", option.LongName); - Assert.AreEqual("s", option.ShortName); + Assert.Equal("long", option.LongName); + Assert.Equal("s", option.ShortName); } - [Test] - [ExpectedException(typeof(InvalidOptionNameException))] + [Fact] public void Ensure_Obsolete_Setup_Does_Not_Allow_Null_Short_And_Long_Options() { var parser = CreateFluentParser(); - parser.Setup(null, null); + Assert.Throws(() => parser.Setup(null, null)); } - [Test] - [ExpectedException(typeof(InvalidOptionNameException))] + [Fact] public void Ensure_Obsolete_Setup_Does_Not_Allow_Empty_Short_And_Long_Options() { var parser = CreateFluentParser(); - parser.Setup(string.Empty, string.Empty); + Assert.Throws(() => parser.Setup(string.Empty, string.Empty)); } - [Test] - [ExpectedException(typeof(InvalidOptionNameException))] + [Fact] public void Ensure_Obsolete_Setup_Does_Not_Allow_Short_Option_With_More_Than_One_Char() { var parser = CreateFluentParser(); - parser.Setup("ab", null); + Assert.Throws(() => parser.Setup("ab", null)); } - [Test] - [ExpectedException(typeof(InvalidOptionNameException))] + [Fact] public void Ensure_Obsolete_Setup_Does_Not_Allow_Long_Option_With_One_Char() { var parser = CreateFluentParser(); - parser.Setup(null, "s"); + Assert.Throws(() => parser.Setup(null, "s")); } #endregion #region Addtional Arguments - [Test] + [Fact] public void Ensure_Additional_Arguments_Callback_Called_When_Additional_Args_Provided() { var parser = CreateFluentParser(); @@ -1649,16 +1640,16 @@ public void Ensure_Additional_Arguments_Callback_Called_When_Additional_Args_Pro var result = parser.Parse(new[] { "--my-option", "value", "--", "addArg1", "addArg2" }); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.EmptyArgs); - Assert.IsFalse(result.HelpCalled); + Assert.False(result.HasErrors); + Assert.False(result.EmptyArgs); + Assert.False(result.HelpCalled); - Assert.AreEqual(2, capturedAdditionalArgs.Count()); - Assert.IsTrue(capturedAdditionalArgs.Contains("addArg1")); - Assert.IsTrue(capturedAdditionalArgs.Contains("addArg2")); + Assert.Equal(2, capturedAdditionalArgs.Count()); + Assert.True(capturedAdditionalArgs.Contains("addArg1")); + Assert.True(capturedAdditionalArgs.Contains("addArg2")); } - [Test] + [Fact] public void Ensure_Additional_Arguments_Callback_Not_Called_When_No_Additional_Args_Provided() { var parser = CreateFluentParser(); @@ -1670,14 +1661,14 @@ public void Ensure_Additional_Arguments_Callback_Not_Called_When_No_Additional_A var result = parser.Parse(new[] { "--my-option", "value" }); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.EmptyArgs); - Assert.IsFalse(result.HelpCalled); + Assert.False(result.HasErrors); + Assert.False(result.EmptyArgs); + Assert.False(result.HelpCalled); - Assert.IsFalse(wasCalled); + Assert.False(wasCalled); } - [Test] + [Fact] public void Ensure_Additional_Arguments_Callback_Not_Called_When_No_Additional_Args_Follow_A_Double_Dash() { var parser = CreateFluentParser(); @@ -1689,14 +1680,14 @@ public void Ensure_Additional_Arguments_Callback_Not_Called_When_No_Additional_A var result = parser.Parse(new[] { "--my-option", "value", "--" }); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.EmptyArgs); - Assert.IsFalse(result.HelpCalled); + Assert.False(result.HasErrors); + Assert.False(result.EmptyArgs); + Assert.False(result.HelpCalled); - Assert.IsFalse(wasCalled); + Assert.False(wasCalled); } - [Test] + [Fact] public void Ensure_Stable_When_Additional_Args_Are_Provided_But_Capture_Additional_Arguments_Has_Not_Been_Setup() { var parser = CreateFluentParser(); @@ -1705,12 +1696,12 @@ public void Ensure_Stable_When_Additional_Args_Are_Provided_But_Capture_Addition var result = parser.Parse(new[] { "--my-option", "value", "--", "addArg1", "addArg2" }); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.EmptyArgs); - Assert.IsFalse(result.HelpCalled); + Assert.False(result.HasErrors); + Assert.False(result.EmptyArgs); + Assert.False(result.HelpCalled); } - [Test] + [Fact] public void Ensure_Additional_Args_Can_Be_Captured_For_Different_Options() { var parser = CreateFluentParser(); @@ -1731,27 +1722,27 @@ public void Ensure_Additional_Args_Can_Be_Captured_For_Different_Options() var result = parser.Parse(new[] { "--option-one", "value-one", "addArg1", "addArg2", "--option-two", "value-two", "addArg3", "addArg4" }); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.EmptyArgs); - Assert.IsFalse(result.HelpCalled); + Assert.False(result.HasErrors); + Assert.False(result.EmptyArgs); + Assert.False(result.HelpCalled); - Assert.AreEqual("value-one", option1Value); - Assert.AreEqual("value-two", option2Value); + Assert.Equal("value-one", option1Value); + Assert.Equal("value-two", option2Value); - Assert.AreEqual(2, option1AddArgs.Count()); - Assert.IsTrue(option1AddArgs.Contains("addArg1")); - Assert.IsTrue(option1AddArgs.Contains("addArg2")); + Assert.Equal(2, option1AddArgs.Count()); + Assert.True(option1AddArgs.Contains("addArg1")); + Assert.True(option1AddArgs.Contains("addArg2")); - Assert.AreEqual(2, option2AddArgs.Count()); - Assert.IsTrue(option2AddArgs.Contains("addArg3")); - Assert.IsTrue(option2AddArgs.Contains("addArg4")); + Assert.Equal(2, option2AddArgs.Count()); + Assert.True(option2AddArgs.Contains("addArg3")); + Assert.True(option2AddArgs.Contains("addArg4")); } #endregion #region Lists - [Test] + [Fact] public void Ensure_Can_Parse_Mulitple_Arguments_Containing_Negative_Integers_To_A_List() { var parser = CreateFluentParser(); @@ -1763,18 +1754,18 @@ public void Ensure_Can_Parse_Mulitple_Arguments_Containing_Negative_Integers_To_ var result = parser.Parse(new[] { "--integers", "--", "123", "-123", "-321", "321" }); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.EmptyArgs); - Assert.IsFalse(result.HelpCalled); + Assert.False(result.HasErrors); + Assert.False(result.EmptyArgs); + Assert.False(result.HelpCalled); - Assert.AreEqual(4, actual.Count()); - Assert.IsTrue(actual.Contains(123)); - Assert.IsTrue(actual.Contains(-123)); - Assert.IsTrue(actual.Contains(-321)); - Assert.IsTrue(actual.Contains(321)); + Assert.Equal(4, actual.Count()); + Assert.True(actual.Contains(123)); + Assert.True(actual.Contains(-123)); + Assert.True(actual.Contains(-321)); + Assert.True(actual.Contains(321)); } - [Test] + [Fact] public void Ensure_Can_Parse_Multiple_Nullable_Enums_To_A_List() { var parser = CreateFluentParser(); @@ -1786,16 +1777,16 @@ public void Ensure_Can_Parse_Multiple_Nullable_Enums_To_A_List() var result = parser.Parse(new[] { "--enums", "--", TestEnum.Value0.ToString(), TestEnum.Value1.ToString() }); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.EmptyArgs); - Assert.IsFalse(result.HelpCalled); + Assert.False(result.HasErrors); + Assert.False(result.EmptyArgs); + Assert.False(result.HelpCalled); - Assert.AreEqual(2, actual.Count()); + Assert.Equal(2, actual.Count()); Assert.Contains(TestEnum.Value0, actual); Assert.Contains(TestEnum.Value1, actual); } - [Test] + [Fact] public void Ensure_Can_Parse_Arguments_Containing_Long_To_A_List() { var parser = CreateFluentParser(); @@ -1811,15 +1802,15 @@ public void Ensure_Can_Parse_Arguments_Containing_Long_To_A_List() var result = parser.Parse(new[] { "--longs", "--", value1.ToString(), value2.ToString(), value3.ToString(), value4.ToString() }); - Assert.IsFalse(result.HasErrors); - Assert.IsFalse(result.EmptyArgs); - Assert.IsFalse(result.HelpCalled); + Assert.False(result.HasErrors); + Assert.False(result.EmptyArgs); + Assert.False(result.HelpCalled); - Assert.AreEqual(4, actual.Count()); - Assert.IsTrue(actual.Contains(value1)); - Assert.IsTrue(actual.Contains(value2)); - Assert.IsTrue(actual.Contains(value3)); - Assert.IsTrue(actual.Contains(value4)); + Assert.Equal(4, actual.Count()); + Assert.True(actual.Contains(value1)); + Assert.True(actual.Contains(value2)); + Assert.True(actual.Contains(value3)); + Assert.True(actual.Contains(value4)); } #endregion @@ -1828,7 +1819,7 @@ public void Ensure_Can_Parse_Arguments_Containing_Long_To_A_List() #region Duplicate Options Tests - [Test] + [Fact] public void Ensure_First_Value_Is_Stored_When_Duplicate_Options_Are_Specified() { var parser = CreateFluentParser(); @@ -1838,7 +1829,7 @@ public void Ensure_First_Value_Is_Stored_When_Duplicate_Options_Are_Specified() parser.Parse(new[] { "/n=1", "/n=2", "-n=3", "--n=4" }); - Assert.AreEqual(1, number); + Assert.Equal(1, number); } #endregion diff --git a/FluentCommandLineParser.Tests/Integration/BoolInlineDataAttribute.cs b/FluentCommandLineParser.Tests/Integration/BoolInlineDataAttribute.cs index d3f7bb6..5d3b781 100644 --- a/FluentCommandLineParser.Tests/Integration/BoolInlineDataAttribute.cs +++ b/FluentCommandLineParser.Tests/Integration/BoolInlineDataAttribute.cs @@ -1,5 +1,5 @@ #region License -// BoolInlineDataAttribute.cs +// InlineDataAttribute.cs // Copyright (c) 2013, Simon Williams // All rights reserved. // @@ -30,5 +30,5 @@ public BoolInlineDataAttribute(string args, bool expected) : base(args, expectedBoolean: expected) { } - } + } } \ No newline at end of file diff --git a/FluentCommandLineParser.Tests/Integration/DoubleInlineDataAttribute.cs b/FluentCommandLineParser.Tests/Integration/DoubleInlineDataAttribute.cs index 113977f..0938291 100644 --- a/FluentCommandLineParser.Tests/Integration/DoubleInlineDataAttribute.cs +++ b/FluentCommandLineParser.Tests/Integration/DoubleInlineDataAttribute.cs @@ -1,5 +1,5 @@ #region License -// DoubleInlineDataAttribute.cs +// InlineDataAttribute.cs // Copyright (c) 2013, Simon Williams // All rights reserved. // diff --git a/FluentCommandLineParser.Tests/Integration/EnumInlineDataAttribute.cs b/FluentCommandLineParser.Tests/Integration/EnumInlineDataAttribute.cs index a98511c..0ef91dc 100644 --- a/FluentCommandLineParser.Tests/Integration/EnumInlineDataAttribute.cs +++ b/FluentCommandLineParser.Tests/Integration/EnumInlineDataAttribute.cs @@ -1,5 +1,5 @@ #region License -// EnumInlineDataAttribute.cs +// InlineDataAttribute.cs // Copyright (c) 2014, Simon Williams // All rights reserved. // diff --git a/FluentCommandLineParser.Tests/Integration/Int32EnumInlineDataAttribute.cs b/FluentCommandLineParser.Tests/Integration/Int32EnumInlineDataAttribute.cs index 0e1a6a3..0039ccc 100644 --- a/FluentCommandLineParser.Tests/Integration/Int32EnumInlineDataAttribute.cs +++ b/FluentCommandLineParser.Tests/Integration/Int32EnumInlineDataAttribute.cs @@ -1,5 +1,5 @@ #region License -// Int32EnumInlineDataAttribute.cs +// InlineDataAttribute.cs // Copyright (c) 2014, Simon Williams // All rights reserved. // diff --git a/FluentCommandLineParser.Tests/Integration/Int32InlineDataAttribute.cs b/FluentCommandLineParser.Tests/Integration/Int32InlineDataAttribute.cs index f021f66..8f5ed0f 100644 --- a/FluentCommandLineParser.Tests/Integration/Int32InlineDataAttribute.cs +++ b/FluentCommandLineParser.Tests/Integration/Int32InlineDataAttribute.cs @@ -1,5 +1,5 @@ #region License -// Int32InlineDataAttribute.cs +// InlineDataAttribute.cs // Copyright (c) 2013, Simon Williams // All rights reserved. // @@ -24,11 +24,12 @@ namespace Fclp.Tests.Integration { - public class Int32InlineDataAttribute : SimpleShortOptionsAreParsedCorrectlyAttribute + /* + public class InlineDataAttribute : SimpleShortOptionsAreParsedCorrectlyAttribute { - public Int32InlineDataAttribute(string args, int expected) + public InlineDataAttribute(string args, int expected) : base(args, expectedInt32: expected) { } - } + } */ } \ No newline at end of file diff --git a/FluentCommandLineParser.Tests/Integration/IntegrationTests.cs b/FluentCommandLineParser.Tests/Integration/IntegrationTests.cs index 575dbeb..c19db61 100644 --- a/FluentCommandLineParser.Tests/Integration/IntegrationTests.cs +++ b/FluentCommandLineParser.Tests/Integration/IntegrationTests.cs @@ -22,6 +22,7 @@ // POSSIBILITY OF SUCH DAMAGE. #endregion +using System.Xml.Linq; using Fclp.Tests.FluentCommandLineParser; using Fclp.Tests.Internals; using Machine.Specifications; @@ -33,54 +34,54 @@ namespace Fclp.Tests.Integration public class IntegrationTests : TestContextBase { [Theory] - [BoolInlineData("-b", true)] - [BoolInlineData("-b+", true)] - [BoolInlineData("-b-", false)] - [BoolInlineData("/b:true", true)] - [BoolInlineData("/b:false", false)] - [BoolInlineData("-b true", true)] - [BoolInlineData("-b false", false)] - [BoolInlineData("-b=true", true)] - [BoolInlineData("-b=false", false)] - [BoolInlineData("-b on", true)] - [BoolInlineData("-b off", false)] - [BoolInlineData("-b ON", true)] - [BoolInlineData("-b OFF", false)] - [BoolInlineData("-b:on", true)] - [BoolInlineData("-b:off", false)] - [BoolInlineData("-b=on", true)] - [BoolInlineData("-b=off", false)] - [BoolInlineData("-b1", true)] - [BoolInlineData("-b0", false)] - [BoolInlineData("/b:1", true)] - [BoolInlineData("/b:0", false)] - [BoolInlineData("-b 1", true)] - [BoolInlineData("-b 0", false)] - [BoolInlineData("-b=1", true)] - [BoolInlineData("-b=0", false)] - [BoolInlineData("-b 1", true)] - [BoolInlineData("-b 0", false)] - [BoolInlineData("-b:1", true)] - [BoolInlineData("-b:0", false)] - [BoolInlineData("-b=1", true)] - [StringInlineData("-s {0}", "Hello World")] - [StringInlineData("-s:{0}", "Hello World")] - [StringInlineData("-s={0}", "Hello World")] - [Int32InlineData("-i 123", 123)] - [Int32InlineData("-i:123", 123)] - [Int32InlineData("-i=123", 123)] - [Int64InlineData("-l 2147483649", 2147483649)] - [Int64InlineData("-l:2147483649", 2147483649)] - [Int64InlineData("-l=2147483649", 2147483649)] - [DoubleInlineData("-d 123.456", 123.456)] - [DoubleInlineData("-d:123.456", 123.456)] - [DoubleInlineData("-d=123.456", 123.456)] - [Int32EnumInlineData("-e 1", TestEnum.Value1)] - [Int32EnumInlineData("-e:1", TestEnum.Value1)] - [Int32EnumInlineData("-e=1", TestEnum.Value1)] - [EnumInlineData("-e Value1", TestEnum.Value1)] - [EnumInlineData("-e:Value1", TestEnum.Value1)] - [EnumInlineData("-e=Value1", TestEnum.Value1)] + [InlineData("-b", true)] + [InlineData("-b+", true)] + [InlineData("-b-", false)] + [InlineData("/b:true", true)] + [InlineData("/b:false", false)] + [InlineData("-b true", true)] + [InlineData("-b false", false)] + [InlineData("-b=true", true)] + [InlineData("-b=false", false)] + [InlineData("-b on", true)] + [InlineData("-b off", false)] + [InlineData("-b ON", true)] + [InlineData("-b OFF", false)] + [InlineData("-b:on", true)] + [InlineData("-b:off", false)] + [InlineData("-b=on", true)] + [InlineData("-b=off", false)] + [InlineData("-b1", true)] + [InlineData("-b0", false)] + [InlineData("/b:1", true)] + [InlineData("/b:0", false)] + [InlineData("-b 1", true)] + [InlineData("-b 0", false)] + [InlineData("-b=1", true)] + [InlineData("-b=0", false)] + [InlineData("-b 1", true)] + [InlineData("-b 0", false)] + [InlineData("-b:1", true)] + [InlineData("-b:0", false)] + [InlineData("-b=1", true)] + [InlineData("-s {0}", "Hello World")] + [InlineData("-s:{0}", "Hello World")] + [InlineData("-s={0}", "Hello World")] + [InlineData("-i 123", 123)] + [InlineData("-i:123", 123)] + [InlineData("-i=123", 123)] + [InlineData("-l 2147483649", 2147483649)] + [InlineData("-l:2147483649", 2147483649)] + [InlineData("-l=2147483649", 2147483649)] + [InlineData("-d 123.456", 123.456)] + [InlineData("-d:123.456", 123.456)] + [InlineData("-d=123.456", 123.456)] + [InlineData("-e 1", TestEnum.Value1)] + [InlineData("-e:1", TestEnum.Value1)] + [InlineData("-e=1", TestEnum.Value1)] + [InlineData("-e Value1", TestEnum.Value1)] + [InlineData("-e:Value1", TestEnum.Value1)] + [InlineData("-e=Value1", TestEnum.Value1)] public void SimpleShortOptionsAreParsedCorrectly( string arguments, bool? expectedBoolean, diff --git a/FluentCommandLineParser.Tests/Integration/Lists/FlagTests.cs b/FluentCommandLineParser.Tests/Integration/Lists/FlagTests.cs index c5c74ec..f095edb 100644 --- a/FluentCommandLineParser.Tests/Integration/Lists/FlagTests.cs +++ b/FluentCommandLineParser.Tests/Integration/Lists/FlagTests.cs @@ -34,35 +34,35 @@ namespace Fclp.Tests.Integration public class FlagTests : TestContextBase { [Theory] - [EnumFlagListInlineData("--flag Value0 Value1", TestEnumFlag.Value0, TestEnumFlag.Value1)] - [EnumFlagListInlineData("-f Value0 Value1", TestEnumFlag.Value0, TestEnumFlag.Value1)] - [EnumFlagListInlineData("/flag Value0 Value1", TestEnumFlag.Value0, TestEnumFlag.Value1)] - [EnumFlagListInlineData("/flag:Value0 Value1", TestEnumFlag.Value0, TestEnumFlag.Value1)] - [EnumFlagListInlineData("/flag=Value0 Value1", TestEnumFlag.Value0, TestEnumFlag.Value1)] - [EnumFlagListInlineData("--flag:Value0 Value1", TestEnumFlag.Value0, TestEnumFlag.Value1)] - [EnumFlagListInlineData("--flag=Value0 Value1", TestEnumFlag.Value0, TestEnumFlag.Value1)] - [EnumFlagListInlineData("--flag 0 1", TestEnumFlag.Value0, TestEnumFlag.Value1)] - [EnumFlagListInlineData("-f 0 1", TestEnumFlag.Value0, TestEnumFlag.Value1)] - [EnumFlagListInlineData("/flag 0 1", TestEnumFlag.Value0, TestEnumFlag.Value1)] - [EnumFlagListInlineData("/flag:0 1", TestEnumFlag.Value0, TestEnumFlag.Value1)] - [EnumFlagListInlineData("/flag=0 1", TestEnumFlag.Value0, TestEnumFlag.Value1)] - [EnumFlagListInlineData("--flag:0 1", TestEnumFlag.Value0, TestEnumFlag.Value1)] - [EnumFlagListInlineData("--flag=0 1", TestEnumFlag.Value0, TestEnumFlag.Value1)] + [InlineData("--flag Value0 Value1", TestEnumFlag.Value0, TestEnumFlag.Value1)] + [InlineData("-f Value0 Value1", TestEnumFlag.Value0, TestEnumFlag.Value1)] + [InlineData("/flag Value0 Value1", TestEnumFlag.Value0, TestEnumFlag.Value1)] + [InlineData("/flag:Value0 Value1", TestEnumFlag.Value0, TestEnumFlag.Value1)] + [InlineData("/flag=Value0 Value1", TestEnumFlag.Value0, TestEnumFlag.Value1)] + [InlineData("--flag:Value0 Value1", TestEnumFlag.Value0, TestEnumFlag.Value1)] + [InlineData("--flag=Value0 Value1", TestEnumFlag.Value0, TestEnumFlag.Value1)] + [InlineData("--flag 0 1", TestEnumFlag.Value0, TestEnumFlag.Value1)] + [InlineData("-f 0 1", TestEnumFlag.Value0, TestEnumFlag.Value1)] + [InlineData("/flag 0 1", TestEnumFlag.Value0, TestEnumFlag.Value1)] + [InlineData("/flag:0 1", TestEnumFlag.Value0, TestEnumFlag.Value1)] + [InlineData("/flag=0 1", TestEnumFlag.Value0, TestEnumFlag.Value1)] + [InlineData("--flag:0 1", TestEnumFlag.Value0, TestEnumFlag.Value1)] + [InlineData("--flag=0 1", TestEnumFlag.Value0, TestEnumFlag.Value1)] - [EnumFlagListInlineData("--flag Value0 Value1 Value16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] - [EnumFlagListInlineData("-f Value0 Value1 Value16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] - [EnumFlagListInlineData("/flag Value0 Value1 Value16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] - [EnumFlagListInlineData("/flag:Value0 Value1 Value16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] - [EnumFlagListInlineData("/flag=Value0 Value1 Value16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] - [EnumFlagListInlineData("--flag:Value0 Value1 Value16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] - [EnumFlagListInlineData("--flag=Value0 Value1 Value16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] - [EnumFlagListInlineData("--flag 0 1 16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] - [EnumFlagListInlineData("-f 0 1 16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] - [EnumFlagListInlineData("/flag 0 1 16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] - [EnumFlagListInlineData("/flag:0 1 16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] - [EnumFlagListInlineData("/flag=0 1 16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] - [EnumFlagListInlineData("--flag:0 1 16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] - [EnumFlagListInlineData("--flag=0 1 16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] + [InlineData("--flag Value0 Value1 Value16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] + [InlineData("-f Value0 Value1 Value16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] + [InlineData("/flag Value0 Value1 Value16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] + [InlineData("/flag:Value0 Value1 Value16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] + [InlineData("/flag=Value0 Value1 Value16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] + [InlineData("--flag:Value0 Value1 Value16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] + [InlineData("--flag=Value0 Value1 Value16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] + [InlineData("--flag 0 1 16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] + [InlineData("-f 0 1 16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] + [InlineData("/flag 0 1 16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] + [InlineData("/flag:0 1 16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] + [InlineData("/flag=0 1 16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] + [InlineData("--flag:0 1 16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] + [InlineData("--flag=0 1 16", TestEnumFlag.Value0, TestEnumFlag.Value1, TestEnumFlag.Value16)] private void should_contain_list_with_expected_items(string arguments, IEnumerable expectedItems) { sut = new Fclp.FluentCommandLineParser(); diff --git a/FluentCommandLineParser.Tests/Integration/Lists/ListTests.cs b/FluentCommandLineParser.Tests/Integration/Lists/ListTests.cs index 0d323da..12326a0 100644 --- a/FluentCommandLineParser.Tests/Integration/Lists/ListTests.cs +++ b/FluentCommandLineParser.Tests/Integration/Lists/ListTests.cs @@ -34,94 +34,94 @@ namespace Fclp.Tests.Integration public class ListTests : TestContextBase { [Theory] - [StringListInlineData("--list file1.txt file2.txt file3.txt", "file1.txt", "file2.txt", "file3.txt")] - [StringListInlineData("-list file1.txt file2.txt file3.txt", "file1.txt", "file2.txt", "file3.txt")] - [StringListInlineData("/list file1.txt file2.txt file3.txt", "file1.txt", "file2.txt", "file3.txt")] - [StringListInlineData("--list 'file 1.txt' file2.txt 'file 3.txt'", "file 1.txt", "file2.txt", "file 3.txt")] - [StringListInlineData("-list 'file 1.txt' file2.txt 'file 3.txt'", "file 1.txt", "file2.txt", "file 3.txt")] - [StringListInlineData("/list 'file 1.txt' file2.txt 'file 3.txt'", "file 1.txt", "file2.txt", "file 3.txt")] - [StringListInlineData("/list='file 1.txt' file2.txt 'file 3.txt'", "file 1.txt", "file2.txt", "file 3.txt")] - [StringListInlineData("/list:'file 1.txt' file2.txt 'file 3.txt'", "file 1.txt", "file2.txt", "file 3.txt")] - [StringListInlineData("--list:'file 1.txt' file2.txt 'file 3.txt'", "file 1.txt", "file2.txt", "file 3.txt")] - [StringListInlineData("--list='file 1.txt' file2.txt 'file 3.txt'", "file 1.txt", "file2.txt", "file 3.txt")] - public void should_create_list_with_expected_strings(string arguments, IEnumerable expectedItems) + [InlineData("--list file1.txt file2.txt file3.txt", "file1.txt", "file2.txt", "file3.txt")] + [InlineData("-list file1.txt file2.txt file3.txt", "file1.txt", "file2.txt", "file3.txt")] + [InlineData("/list file1.txt file2.txt file3.txt", "file1.txt", "file2.txt", "file3.txt")] + [InlineData("--list 'file 1.txt' file2.txt 'file 3.txt'", "file 1.txt", "file2.txt", "file 3.txt")] + [InlineData("-list 'file 1.txt' file2.txt 'file 3.txt'", "file 1.txt", "file2.txt", "file 3.txt")] + [InlineData("/list 'file 1.txt' file2.txt 'file 3.txt'", "file 1.txt", "file2.txt", "file 3.txt")] + [InlineData("/list='file 1.txt' file2.txt 'file 3.txt'", "file 1.txt", "file2.txt", "file 3.txt")] + [InlineData("/list:'file 1.txt' file2.txt 'file 3.txt'", "file 1.txt", "file2.txt", "file 3.txt")] + [InlineData("--list:'file 1.txt' file2.txt 'file 3.txt'", "file 1.txt", "file2.txt", "file 3.txt")] + [InlineData("--list='file 1.txt' file2.txt 'file 3.txt'", "file 1.txt", "file2.txt", "file 3.txt")] + public void should_create_list_with_expected_strings(string arguments, string[] expectedItems) { should_contain_list_with_expected_items(arguments, expectedItems); } [Theory] - [Int32ListInlineData("--list 123 321 098", 123, 321, 098)] - [Int32ListInlineData("-list 123 321 098", 123, 321, 098)] - [Int32ListInlineData("/list 123 321 098", 123, 321, 098)] - [Int32ListInlineData("/list:123 321 098", 123, 321, 098)] - [Int32ListInlineData("/list=123 321 098", 123, 321, 098)] - [Int32ListInlineData("--list:123 321 098", 123, 321, 098)] - [Int32ListInlineData("--list=123 321 098", 123, 321, 098)] - public void should_create_list_with_expected_int32_items(string arguments, IEnumerable expectedItems) + [InlineData("--list 123 321 098", 123, 321, 098)] + [InlineData("-list 123 321 098", 123, 321, 098)] + [InlineData("/list 123 321 098", 123, 321, 098)] + [InlineData("/list:123 321 098", 123, 321, 098)] + [InlineData("/list=123 321 098", 123, 321, 098)] + [InlineData("--list:123 321 098", 123, 321, 098)] + [InlineData("--list=123 321 098", 123, 321, 098)] + public void should_create_list_with_expected_int32_items(string arguments, int[] expectedItems) { should_contain_list_with_expected_items(arguments, expectedItems); } [Theory] - [Int64ListInlineData("--list 2147483650 3147483651 4147483652", 2147483650, 3147483651, 4147483652)] - [Int64ListInlineData("-list 2147483650 3147483651 4147483652", 2147483650, 3147483651, 4147483652)] - [Int64ListInlineData("/list 2147483650 3147483651 4147483652", 2147483650, 3147483651, 4147483652)] - [Int64ListInlineData("/list:2147483650 3147483651 4147483652", 2147483650, 3147483651, 4147483652)] - [Int64ListInlineData("/list=2147483650 3147483651 4147483652", 2147483650, 3147483651, 4147483652)] - [Int64ListInlineData("--list:2147483650 3147483651 4147483652", 2147483650, 3147483651, 4147483652)] - [Int64ListInlineData("--list=2147483650 3147483651 4147483652", 2147483650, 3147483651, 4147483652)] - public void should_create_list_with_expected_int64_items(string arguments, IEnumerable expectedItems) + [InlineData("--list 2147483650 3147483651 4147483652", 2147483650, 3147483651, 4147483652)] + [InlineData("-list 2147483650 3147483651 4147483652", 2147483650, 3147483651, 4147483652)] + [InlineData("/list 2147483650 3147483651 4147483652", 2147483650, 3147483651, 4147483652)] + [InlineData("/list:2147483650 3147483651 4147483652", 2147483650, 3147483651, 4147483652)] + [InlineData("/list=2147483650 3147483651 4147483652", 2147483650, 3147483651, 4147483652)] + [InlineData("--list:2147483650 3147483651 4147483652", 2147483650, 3147483651, 4147483652)] + [InlineData("--list=2147483650 3147483651 4147483652", 2147483650, 3147483651, 4147483652)] + public void should_create_list_with_expected_int64_items(string arguments, long[] expectedItems) { should_contain_list_with_expected_items(arguments, expectedItems); } [Theory] - [DoubleListInlineData("--list 123.456 321.987 098.123465", 123.456, 321.987, 098.123465)] - [DoubleListInlineData("-list 123.456 321.987 098.123465", 123.456, 321.987, 098.123465)] - [DoubleListInlineData("/list 123.456 321.987 098.123465", 123.456, 321.987, 098.123465)] - [DoubleListInlineData("/list:123.456 321.987 098.123465", 123.456, 321.987, 098.123465)] - [DoubleListInlineData("/list=123.456 321.987 098.123465", 123.456, 321.987, 098.123465)] - [DoubleListInlineData("--list:123.456 321.987 098.123465", 123.456, 321.987, 098.123465)] - [DoubleListInlineData("--list=123.456 321.987 098.123465", 123.456, 321.987, 098.123465)] - public void should_create_list_with_expected_double_items(string arguments, IEnumerable expectedItems) + [InlineData("--list 123.456 321.987 098.123465", 123.456, 321.987, 098.123465)] + [InlineData("-list 123.456 321.987 098.123465", 123.456, 321.987, 098.123465)] + [InlineData("/list 123.456 321.987 098.123465", 123.456, 321.987, 098.123465)] + [InlineData("/list:123.456 321.987 098.123465", 123.456, 321.987, 098.123465)] + [InlineData("/list=123.456 321.987 098.123465", 123.456, 321.987, 098.123465)] + [InlineData("--list:123.456 321.987 098.123465", 123.456, 321.987, 098.123465)] + [InlineData("--list=123.456 321.987 098.123465", 123.456, 321.987, 098.123465)] + public void should_create_list_with_expected_double_items(string arguments, double[] expectedItems) { should_contain_list_with_expected_items(arguments, expectedItems); } [Theory] - [BoolListInlineData("--list true false true", true, false, true)] - [BoolListInlineData("-l true false true", true, false, true)] - [BoolListInlineData("/list true false true", true, false, true)] - [BoolListInlineData("/list:true false true", true, false, true)] - [BoolListInlineData("/list=true false true", true, false, true)] - [BoolListInlineData("--list:true false true", true, false, true)] - [BoolListInlineData("--list=true false true", true, false, true)] - public void should_create_list_with_expected_bool_items(string arguments, IEnumerable expectedItems) + [InlineData("--list true false true", true, false, true)] + [InlineData("-l true false true", true, false, true)] + [InlineData("/list true false true", true, false, true)] + [InlineData("/list:true false true", true, false, true)] + [InlineData("/list=true false true", true, false, true)] + [InlineData("--list:true false true", true, false, true)] + [InlineData("--list=true false true", true, false, true)] + public void should_create_list_with_expected_bool_items(string arguments, params bool[] expectedItems) { should_contain_list_with_expected_items(arguments, expectedItems); } [Theory] - [EnumListInlineData("--list Value0 Value1", TestEnum.Value0, TestEnum.Value1)] - [EnumListInlineData("-l Value0 Value1", TestEnum.Value0, TestEnum.Value1)] - [EnumListInlineData("/list Value0 Value1", TestEnum.Value0, TestEnum.Value1)] - [EnumListInlineData("/list:Value0 Value1", TestEnum.Value0, TestEnum.Value1)] - [EnumListInlineData("/list=Value0 Value1", TestEnum.Value0, TestEnum.Value1)] - [EnumListInlineData("--list:Value0 Value1", TestEnum.Value0, TestEnum.Value1)] - [EnumListInlineData("--list=Value0 Value1", TestEnum.Value0, TestEnum.Value1)] - [EnumListInlineData("--list 0 1", TestEnum.Value0, TestEnum.Value1)] - [EnumListInlineData("-l 0 1", TestEnum.Value0, TestEnum.Value1)] - [EnumListInlineData("/list 0 1", TestEnum.Value0, TestEnum.Value1)] - [EnumListInlineData("/list:0 1", TestEnum.Value0, TestEnum.Value1)] - [EnumListInlineData("/list=0 1", TestEnum.Value0, TestEnum.Value1)] - [EnumListInlineData("--list:0 1", TestEnum.Value0, TestEnum.Value1)] - [EnumListInlineData("--list=0 1", TestEnum.Value0, TestEnum.Value1)] - public void should_create_list_with_expected_enum_items(string arguments, IEnumerable expectedItems) + [InlineData("--list Value0 Value1", TestEnum.Value0, TestEnum.Value1)] + [InlineData("-l Value0 Value1", TestEnum.Value0, TestEnum.Value1)] + [InlineData("/list Value0 Value1", TestEnum.Value0, TestEnum.Value1)] + [InlineData("/list:Value0 Value1", TestEnum.Value0, TestEnum.Value1)] + [InlineData("/list=Value0 Value1", TestEnum.Value0, TestEnum.Value1)] + [InlineData("--list:Value0 Value1", TestEnum.Value0, TestEnum.Value1)] + [InlineData("--list=Value0 Value1", TestEnum.Value0, TestEnum.Value1)] + [InlineData("--list 0 1", TestEnum.Value0, TestEnum.Value1)] + [InlineData("-l 0 1", TestEnum.Value0, TestEnum.Value1)] + [InlineData("/list 0 1", TestEnum.Value0, TestEnum.Value1)] + [InlineData("/list:0 1", TestEnum.Value0, TestEnum.Value1)] + [InlineData("/list=0 1", TestEnum.Value0, TestEnum.Value1)] + [InlineData("--list:0 1", TestEnum.Value0, TestEnum.Value1)] + [InlineData("--list=0 1", TestEnum.Value0, TestEnum.Value1)] + public void should_create_list_with_expected_enum_items(string arguments, params TestEnum[] expectedItems) { should_contain_list_with_expected_items(arguments, expectedItems); } - private void should_contain_list_with_expected_items(string arguments, IEnumerable expectedItems) + private void should_contain_list_with_expected_items(string arguments, params T[] expectedItems) { sut = new Fclp.FluentCommandLineParser(); diff --git a/FluentCommandLineParser.Tests/Integration/NCrunchExcelDataAttribute.cs b/FluentCommandLineParser.Tests/Integration/NCrunchExcelDataAttribute.cs index 3fe1ab4..0bbef1d 100644 --- a/FluentCommandLineParser.Tests/Integration/NCrunchExcelDataAttribute.cs +++ b/FluentCommandLineParser.Tests/Integration/NCrunchExcelDataAttribute.cs @@ -27,7 +27,7 @@ using Xunit.Extensions; namespace Fclp.Tests.Integration -{ +{ /* public class NCrunchExcelDataAttribute : ExcelDataAttribute { public NCrunchExcelDataAttribute(string filename, string selectStatement) @@ -45,5 +45,5 @@ private static string GetPathFromContext(string filename) return newFilePath; } - } + } */ } \ No newline at end of file diff --git a/FluentCommandLineParser.Tests/Integration/SimpleShortOptionsAreParsedCorrectlyAttribute.cs b/FluentCommandLineParser.Tests/Integration/SimpleShortOptionsAreParsedCorrectlyAttribute.cs index 6cc3389..e279a65 100644 --- a/FluentCommandLineParser.Tests/Integration/SimpleShortOptionsAreParsedCorrectlyAttribute.cs +++ b/FluentCommandLineParser.Tests/Integration/SimpleShortOptionsAreParsedCorrectlyAttribute.cs @@ -22,12 +22,43 @@ // POSSIBILITY OF SUCH DAMAGE. #endregion +using System.Collections.Generic; +using System.Reflection; using Fclp.Tests.FluentCommandLineParser; -using Xunit.Extensions; +using Xunit; +using Xunit.Sdk; namespace Fclp.Tests.Integration -{ - public class SimpleShortOptionsAreParsedCorrectlyAttribute : InlineDataAttribute +{ + + /// + /// Provides a data source for a data theory, with the data coming from inline values. + /// + public class InlineDataAttribute : DataAttribute + { + private readonly object[] data; + + /// + /// Initializes a new instance of the class. + /// + /// The data values to pass to the theory. + public InlineDataAttribute(params object[] data) + { + this.data = data; + } + + /// + public override IEnumerable GetData(MethodInfo testMethod) + { + return (IEnumerable) new object[1][] + { + this.data + }; + } + } + + + public class SimpleShortOptionsAreParsedCorrectlyAttribute : Fclp.Tests.Integration.InlineDataAttribute { public SimpleShortOptionsAreParsedCorrectlyAttribute( string arguments, @@ -41,5 +72,5 @@ public SimpleShortOptionsAreParsedCorrectlyAttribute( { } - } + } } \ No newline at end of file diff --git a/FluentCommandLineParser.Tests/Integration/StringInlineDataAttribute.cs b/FluentCommandLineParser.Tests/Integration/StringInlineDataAttribute.cs index d90a7d4..db0354e 100644 --- a/FluentCommandLineParser.Tests/Integration/StringInlineDataAttribute.cs +++ b/FluentCommandLineParser.Tests/Integration/StringInlineDataAttribute.cs @@ -1,5 +1,5 @@ #region License -// StringInlineDataAttribute.cs +// InlineDataAttribute.cs // Copyright (c) 2013, Simon Williams // All rights reserved. // diff --git a/FluentCommandLineParser.Tests/Internals/AnonymousMock.cs b/FluentCommandLineParser.Tests/Internals/AnonymousMock.cs index 8039c51..5136add 100644 --- a/FluentCommandLineParser.Tests/Internals/AnonymousMock.cs +++ b/FluentCommandLineParser.Tests/Internals/AnonymousMock.cs @@ -26,8 +26,8 @@ using System.Linq.Expressions; using System.Reflection; using Moq; -using Ploeh.AutoFixture; -using Ploeh.AutoFixture.Kernel; +using AutoFixture; +using AutoFixture.Kernel; namespace Fclp.Tests.Internals { diff --git a/FluentCommandLineParser.Tests/Internals/CommandLineOptionFactoryTests.cs b/FluentCommandLineParser.Tests/Internals/CommandLineOptionFactoryTests.cs index b4cb377..f17029c 100644 --- a/FluentCommandLineParser.Tests/Internals/CommandLineOptionFactoryTests.cs +++ b/FluentCommandLineParser.Tests/Internals/CommandLineOptionFactoryTests.cs @@ -26,23 +26,22 @@ using Fclp.Internals.Parsing; using Fclp.Internals.Parsing.OptionParsers; using Moq; -using NUnit.Framework; +using Xunit; namespace FluentCommandLineParser.Tests.Internals { /// /// Contains unit tests for the class. /// - [TestFixture] public class CommandLineOptionFactoryTests { - [Test] + [Fact] public void Ensure_Can_Be_Constructed() { new CommandLineOptionFactory(); } - [Test] + [Fact] public void Ensure_CreateCommandLineOption_Returns_Expected_Object() { var factory = new CommandLineOptionFactory(); @@ -56,9 +55,9 @@ public void Ensure_CreateCommandLineOption_Returns_Expected_Object() var actual = factory.CreateOption(expectedShortName, expectedLongName); - Assert.IsInstanceOf>(actual, "Factory returned unexpected object"); - Assert.AreEqual(expectedShortName, actual.ShortName, "Factory returned Option with unexpected ShortName"); - Assert.AreEqual(expectedShortName, actual.ShortName, "Factory returned Option with unexpected LongName"); + Assert.IsType>(actual); //, "Factory returned unexpected object"); + Assert.Equal(expectedShortName, actual.ShortName); //, "Factory returned Option with unexpected ShortName"); + Assert.Equal(expectedShortName, actual.ShortName); //, "Factory returned Option with unexpected LongName"); } } } diff --git a/FluentCommandLineParser.Tests/Internals/CommandLineOptionParserFactoryTests.cs b/FluentCommandLineParser.Tests/Internals/CommandLineOptionParserFactoryTests.cs index 9748f2d..836a0de 100644 --- a/FluentCommandLineParser.Tests/Internals/CommandLineOptionParserFactoryTests.cs +++ b/FluentCommandLineParser.Tests/Internals/CommandLineOptionParserFactoryTests.cs @@ -27,28 +27,26 @@ using Fclp.Internals.Parsing.OptionParsers; using Fclp.Tests.FluentCommandLineParser; using Moq; -using NUnit.Framework; +using Xunit; namespace FluentCommandLineParser.Tests.Internals { - [TestFixture] public class CommandLineOptionParserFactoryTests { - [Test] + [Fact] public void Enure_Can_Be_Constructed() { new CommandLineOptionParserFactory(); } - [Test] - [ExpectedException(typeof(ArgumentNullException))] + [Fact] public void Ensure_Cannot_Add_Null_Parser() { var factory = new CommandLineOptionParserFactory(); - factory.AddOrReplace(null); + Assert.Throws(() => factory.AddOrReplace(null)); } - [Test] + [Fact] public void Ensure_Can_Add_Custom_Parser() { var factory = new CommandLineOptionParserFactory(); @@ -59,10 +57,10 @@ public void Ensure_Can_Add_Custom_Parser() var actual = factory.CreateParser(); - Assert.AreSame(mockParser.Object, actual); + Assert.Same(mockParser.Object, actual); } - [Test] + [Fact] public void Ensure_Can_Replace_Existing_Parser() { var factory = new CommandLineOptionParserFactory(); @@ -77,19 +75,18 @@ public void Ensure_Can_Replace_Existing_Parser() var actual = factory.CreateParser(); - Assert.AreSame(mockParser.Object, actual); + Assert.Same(mockParser.Object, actual); } - [Test] - [ExpectedException(typeof(UnsupportedTypeException))] + [Fact] public void Ensure_UnsupportedTypeException_Thrown_If_Factory_Is_Unable_To_Create_Requested_Type() { var factory = new CommandLineOptionParserFactory(); - factory.CreateParser(); + Assert.Throws(() => factory.CreateParser()); } - [Test] + [Fact] public void Ensure_Factory_Supports_Out_Of_The_Box_Parsers() { var factory = new CommandLineOptionParserFactory(); @@ -101,45 +98,45 @@ public void Ensure_Factory_Supports_Out_Of_The_Box_Parsers() var dtParser = factory.CreateParser(); var boolParser = factory.CreateParser(); - Assert.IsInstanceOf(stringParser); - Assert.IsInstanceOf(int32Parser); - Assert.IsInstanceOf(int64Parser); - Assert.IsInstanceOf(doubleParser); - Assert.IsInstanceOf(dtParser); - Assert.IsInstanceOf(boolParser); + Assert.IsType(stringParser); + Assert.IsType(int32Parser); + Assert.IsType(int64Parser); + Assert.IsType(doubleParser); + Assert.IsType(dtParser); + Assert.IsType(boolParser); } - [Test] + [Fact] public void Ensure_Factory_Supports_List_Of_Int64() { var factory = new CommandLineOptionParserFactory(); var int64ListParser = factory.CreateParser>(); - Assert.IsInstanceOf>(int64ListParser); + Assert.IsType>(int64ListParser); } - [Test] + [Fact] public void Ensure_Factory_Supports_Enum() { var factory = new CommandLineOptionParserFactory(); var enumParser = factory.CreateParser(); - Assert.IsInstanceOf>(enumParser); + Assert.IsType>(enumParser); } - [Test] + [Fact] public void Ensure_Factory_Supports_EnumFlags() { var factory = new CommandLineOptionParserFactory(); var enumParser = factory.CreateParser(); - Assert.IsInstanceOf>(enumParser); + Assert.IsType>(enumParser); } - [Test] + [Fact] public void Ensure_Factory_Returns_Custom_Enum_Formatter() { var factory = new CommandLineOptionParserFactory(); @@ -148,7 +145,7 @@ public void Ensure_Factory_Returns_Custom_Enum_Formatter() factory.AddOrReplace(customParser); var enumParser = factory.CreateParser(); - Assert.AreSame(customParser, enumParser); + Assert.Same(customParser, enumParser); } } diff --git a/FluentCommandLineParser.Tests/Internals/CommandLineOptionTests.cs b/FluentCommandLineParser.Tests/Internals/CommandLineOptionTests.cs index 513f659..9428022 100644 --- a/FluentCommandLineParser.Tests/Internals/CommandLineOptionTests.cs +++ b/FluentCommandLineParser.Tests/Internals/CommandLineOptionTests.cs @@ -28,19 +28,18 @@ using Fclp.Internals.Parsing; using Fclp.Internals.Parsing.OptionParsers; using Moq; -using NUnit.Framework; +using Xunit; namespace FluentCommandLineParser.Tests.Internals { /// /// Contains unit tests for the class. /// - [TestFixture] - class CommandLineOptionTests + public class CommandLineOptionTests { #region Constructor Tests - [Test] + [Fact] public void Ensure_Can_Be_Constructed() { const string expectedShortName = "My short name"; @@ -49,11 +48,11 @@ public void Ensure_Can_Be_Constructed() var cmdOption = new CommandLineOption(expectedShortName, expectedLongName, mockParser); - Assert.AreEqual(expectedShortName, cmdOption.ShortName, "Specified ShortName was not as expected"); - Assert.AreEqual(expectedLongName, cmdOption.LongName, "Specified LongName was not as expected"); + Assert.Equal(expectedShortName, cmdOption.ShortName); //, "Specified ShortName was not as expected"); + Assert.Equal(expectedLongName, cmdOption.LongName); //, "Specified LongName was not as expected"); } - [Test] + [Fact] public void Ensure_Can_Be_Constructed_With_Null_LongName() { const string expectedShortName = "My short name"; @@ -62,10 +61,10 @@ public void Ensure_Can_Be_Constructed_With_Null_LongName() var cmdOption = new CommandLineOption(expectedShortName, expectedLongName, mockParser); - Assert.IsNull(cmdOption.LongName, "Could not instantiate with null LongName"); + Assert.Null(cmdOption.LongName); //, "Could not instantiate with null LongName"); } - [Test] + [Fact] public void Ensure_Can_Be_Constructed_With_Empty_LongName() { const string expectedShortName = "My short name"; @@ -74,10 +73,10 @@ public void Ensure_Can_Be_Constructed_With_Empty_LongName() var cmdOption = new CommandLineOption(expectedShortName, expectedLongName, mockParser); - Assert.AreEqual(expectedLongName, cmdOption.LongName, "Could not instantiate with empty LongName"); + Assert.Equal(expectedLongName, cmdOption.LongName); //, "Could not instantiate with empty LongName"); } - [Test] + [Fact] public void Ensure_Can_Be_Constructed_With_Whitespace_Only_LongName() { const string expectedShortName = "My short name"; @@ -86,10 +85,10 @@ public void Ensure_Can_Be_Constructed_With_Whitespace_Only_LongName() var cmdOption = new CommandLineOption(expectedShortName, expectedLongName, mockParser); - Assert.AreEqual(expectedLongName, cmdOption.LongName, "Could not instantiate with whitespace only LongName"); + Assert.Equal(expectedLongName, cmdOption.LongName); //, "Could not instantiate with whitespace only LongName"); } - [Test] + [Fact] public void Ensure_Can_Be_Constructed_With_Null_ShortName_And_Valid_LongName() { const string expectedShortName = null; @@ -99,10 +98,10 @@ public void Ensure_Can_Be_Constructed_With_Null_ShortName_And_Valid_LongName() var cmdOption = new CommandLineOption(expectedShortName, expectedLongName, mockParser); - Assert.AreEqual(expectedShortName, cmdOption.ShortName, "Could not instantiate with null ShortName"); + Assert.Equal(expectedShortName, cmdOption.ShortName); //, "Could not instantiate with null ShortName"); } - [Test] + [Fact] public void Ensure_Can_Be_Constructed_With_Empty_ShortName_And_Valid_LongName() { const string expectedShortName = ""; @@ -111,10 +110,10 @@ public void Ensure_Can_Be_Constructed_With_Empty_ShortName_And_Valid_LongName() var cmdOption = new CommandLineOption(expectedShortName, expectedLongName, mockParser); - Assert.AreEqual(expectedShortName, cmdOption.ShortName, "Could not instantiate with empty ShortName"); + Assert.Equal(expectedShortName, cmdOption.ShortName); //, "Could not instantiate with empty ShortName"); } - [Test] + [Fact] public void Ensure_Can_Be_Constructed_With_Whitespace_Only_ShortName_And_Valid_LongName() { const string expectedShortName = " "; @@ -123,10 +122,10 @@ public void Ensure_Can_Be_Constructed_With_Whitespace_Only_ShortName_And_Valid_L var cmdOption = new CommandLineOption(expectedShortName, expectedLongName, mockParser); - Assert.AreEqual(expectedShortName, cmdOption.ShortName, "Could not instantiate with whitespace only ShortName"); + Assert.Equal(expectedShortName, cmdOption.ShortName); //, "Could not instantiate with whitespace only ShortName"); } - [Test] + [Fact] public void Ensure_Can_Be_Constructed_With_Null_ShortName_And_Null_LongName() { const string invalidShortName = null; @@ -137,7 +136,7 @@ public void Ensure_Can_Be_Constructed_With_Null_ShortName_And_Null_LongName() new CommandLineOption(invalidShortName, invalidLongName, mockParser); } - [Test] + [Fact] public void Ensure_Can_Be_Constructed_With_Empty_ShortName_And_Null_LongName() { const string invalidShortName = ""; @@ -148,7 +147,7 @@ public void Ensure_Can_Be_Constructed_With_Empty_ShortName_And_Null_LongName() new CommandLineOption(invalidShortName, invalidLongName, mockParser); } - [Test] + [Fact] public void Ensure_Can_Be_Constructed_With_WhiteSpaceOnly_ShortName_And_Null_LongName() { const string invalidShortName = " "; @@ -159,7 +158,7 @@ public void Ensure_Can_Be_Constructed_With_WhiteSpaceOnly_ShortName_And_Null_Lon new CommandLineOption(invalidShortName, invalidLongName, mockParser); } - [Test] + [Fact] public void Ensure_Can_Be_Constructed_With_Null_ShortName_And_Empty_LongName() { const string invalidShortName = null; @@ -170,7 +169,7 @@ public void Ensure_Can_Be_Constructed_With_Null_ShortName_And_Empty_LongName() new CommandLineOption(invalidShortName, invalidLongName, mockParser); } - [Test] + [Fact] public void Ensure_Can_Be_Constructed_With_Empty_ShortName_And_Empty_LongName() { const string invalidShortName = ""; @@ -181,7 +180,7 @@ public void Ensure_Can_Be_Constructed_With_Empty_ShortName_And_Empty_LongName() new CommandLineOption(invalidShortName, invalidLongName, mockParser); } - [Test] + [Fact] public void Ensure_Can_Be_Constructed_With_WhiteSpaceOnly_ShortName_And_Empty_LongName() { const string invalidShortName = " "; @@ -192,7 +191,7 @@ public void Ensure_Can_Be_Constructed_With_WhiteSpaceOnly_ShortName_And_Empty_Lo new CommandLineOption(invalidShortName, invalidLongName, mockParser); } - [Test] + [Fact] public void Ensure_Can_Be_Constructed_With_Null_ShortName_And_WhiteSpaceOnly_LongName() { const string invalidShortName = null; @@ -203,7 +202,7 @@ public void Ensure_Can_Be_Constructed_With_Null_ShortName_And_WhiteSpaceOnly_Lon new CommandLineOption(invalidShortName, invalidLongName, mockParser); } - [Test] + [Fact] public void Ensure_Can_Be_Constructed_With_Empty_ShortName_And_WhiteSpaceOnly_LongName() { const string invalidShortName = ""; @@ -214,7 +213,7 @@ public void Ensure_Can_Be_Constructed_With_Empty_ShortName_And_WhiteSpaceOnly_Lo new CommandLineOption(invalidShortName, invalidLongName, mockParser); } - [Test] + [Fact] public void Ensure_Canot_Be_Constructed_With_WhiteSpaceOnly_ShortName_And_WhiteSpaceOnly_LongName() { const string invalidShortName = " "; @@ -225,8 +224,8 @@ public void Ensure_Canot_Be_Constructed_With_WhiteSpaceOnly_ShortName_And_WhiteS new CommandLineOption(invalidShortName, invalidLongName, mockParser); } - [Test] - [ExpectedException(typeof(ArgumentNullException))] + [Fact] + //[ExpectedException(typeof(ArgumentNullException))] public void Ensure_Cannot_Be_Constructed_With_Null_Parser() { const string expectedShortName = "My short name"; @@ -239,40 +238,41 @@ public void Ensure_Cannot_Be_Constructed_With_Null_Parser() #region HasLongName Tests - [Test] + [Fact] public void Ensure_Returns_False_If_Null_LongName_Provided() { ICommandLineOption cmdOption = new CommandLineOption("s", null, Mock.Of>()); - Assert.IsFalse(cmdOption.HasLongName); + Assert.False(cmdOption.HasLongName); } - [Test] + [Fact] public void Ensure_Returns_False_If_WhiteSpace_LongName_Provided() { ICommandLineOption cmdOption = new CommandLineOption("s", " ", Mock.Of>()); - Assert.IsFalse(cmdOption.HasLongName); + Assert.False(cmdOption.HasLongName); } - [Test] + [Fact] public void Ensure_Returns_False_If_Empty_LongName_Provided() { ICommandLineOption cmdOption = new CommandLineOption("s", string.Empty, Mock.Of>()); - Assert.IsFalse(cmdOption.HasLongName); + Assert.False(cmdOption.HasLongName); } - [Test] + [Fact] public void Ensure_Returns_True_If_LongName_Provided() { ICommandLineOption cmdOption = new CommandLineOption("s", "long name", Mock.Of>()); - Assert.IsTrue(cmdOption.HasLongName); + Assert.True(cmdOption.HasLongName); } #endregion HasLongName Tests + #region Bind Tests - [Test] - [ExpectedException(typeof(OptionSyntaxException))] + [Fact] + //// [ExpectedException(typeof(OptionSyntaxException))] public void Ensure_That_If_Value_Is_Null_Cannot_Be_Parsed_And_No_Default_Set_Then_optionSyntaxException_Is_Thrown() { var option = new ParsedOption(); @@ -286,8 +286,8 @@ public void Ensure_That_If_Value_Is_Null_Cannot_Be_Parsed_And_No_Default_Set_The } - [Test] - [ExpectedException(typeof(OptionSyntaxException))] + [Fact] + // [ExpectedException(typeof(OptionSyntaxException))] public void Ensure_That_If_Value_Is_Empty_Cannot_Be_Parsed_And_No_Default_Set_Then_optionSyntaxException_Is_Thrown() { var option = new ParsedOption(); @@ -301,8 +301,8 @@ public void Ensure_That_If_Value_Is_Empty_Cannot_Be_Parsed_And_No_Default_Set_Th } - [Test] - [ExpectedException(typeof(OptionSyntaxException))] + [Fact] + // [ExpectedException(typeof(OptionSyntaxException))] public void Ensure_That_If_Value_Is_Whitespace_Cannot_Be_Parsed_And_No_Default_Set_Then_optionSyntaxException_Is_Thrown() { var option = new ParsedOption(); diff --git a/FluentCommandLineParser.Tests/Internals/CommandLineParserEngineMark2TestsXUnit.cs b/FluentCommandLineParser.Tests/Internals/CommandLineParserEngineMark2TestsXUnit.cs index aeb0c77..545a97a 100644 --- a/FluentCommandLineParser.Tests/Internals/CommandLineParserEngineMark2TestsXUnit.cs +++ b/FluentCommandLineParser.Tests/Internals/CommandLineParserEngineMark2TestsXUnit.cs @@ -31,9 +31,10 @@ namespace Fclp.Tests.Internals { - public class SingleOptionInlineDataAttribute : InlineDataAttribute + /* + public class InlineDataAttribute : Fclp.Tests.Integration.InlineDataAttribute { - public SingleOptionInlineDataAttribute( + public InlineDataAttribute( string arguments, string expectedKeyChar, string expectedKey, @@ -43,9 +44,9 @@ public SingleOptionInlineDataAttribute( } } - public class DoubleOptionInlineDataAttribute : InlineDataAttribute + public class InlineDataAttribute : Fclp.Tests.Integration.InlineDataAttribute { - public DoubleOptionInlineDataAttribute( + public InlineDataAttribute( string arguments, string firstExpectedKeyChar, string firstExpectedKey, @@ -62,38 +63,38 @@ public DoubleOptionInlineDataAttribute( secondExpectedValue) { } - } + } */ public class CommandLineParserEngineMark2TestsXUnit: TestContextBase { [Theory] - [SingleOptionInlineData("-f", "-", "f", null)] - [SingleOptionInlineData("/f", "/", "f", null)] - [SingleOptionInlineData("--f", "--", "f", null)] - [SingleOptionInlineData("-f apple", "-", "f", "apple")] - [SingleOptionInlineData("/f apple", "/", "f", "apple")] - [SingleOptionInlineData("--f apple", "--", "f", "apple")] - [SingleOptionInlineData("-f", "-", "f", null)] - [SingleOptionInlineData("/fruit", "/", "fruit", null)] - [SingleOptionInlineData("--fruit", "--", "fruit", null)] - [SingleOptionInlineData("/fruit apple", "/", "fruit", "apple")] - [SingleOptionInlineData("--fruit apple", "--", "fruit", "apple")] - [SingleOptionInlineData("-f apple", "-", "f", "apple")] - [SingleOptionInlineData("/fruit:apple", "/", "fruit", "apple")] - [SingleOptionInlineData("--fruit:apple", "--", "fruit", "apple")] - [SingleOptionInlineData("-f:apple", "-", "f", "apple")] - [SingleOptionInlineData("/fruit=apple", "/", "fruit", "apple")] - [SingleOptionInlineData("--fruit=apple", "--", "fruit", "apple")] - [SingleOptionInlineData("-f=apple", "-", "f", "apple")] - [SingleOptionInlineData("/fruit 'apple pear plum'", "/", "fruit", "'apple pear plum'")] - [SingleOptionInlineData("--fruit 'apple pear plum'", "--", "fruit", "'apple pear plum'")] - [SingleOptionInlineData("-f 'apple pear plum'", "-", "f", "'apple pear plum'")] - [SingleOptionInlineData("/fruit:'apple pear plum'", "/", "fruit", "'apple pear plum'")] - [SingleOptionInlineData("--fruit:'apple pear plum'", "--", "fruit", "'apple pear plum'")] - [SingleOptionInlineData("-f:'apple pear plum'", "-", "f", "'apple pear plum'")] - [SingleOptionInlineData("/fruit='apple pear plum'", "/", "fruit", "'apple pear plum'")] - [SingleOptionInlineData("--fruit='apple pear plum'", "--", "fruit", "'apple pear plum'")] - [SingleOptionInlineData("-f='apple pear plum'", "-", "f", "'apple pear plum'")] + [InlineData("-f", "-", "f", null)] + [InlineData("/f", "/", "f", null)] + [InlineData("--f", "--", "f", null)] + [InlineData("-f apple", "-", "f", "apple")] + [InlineData("/f apple", "/", "f", "apple")] + [InlineData("--f apple", "--", "f", "apple")] + [InlineData("-f", "-", "f", null)] + [InlineData("/fruit", "/", "fruit", null)] + [InlineData("--fruit", "--", "fruit", null)] + [InlineData("/fruit apple", "/", "fruit", "apple")] + [InlineData("--fruit apple", "--", "fruit", "apple")] + [InlineData("-f apple", "-", "f", "apple")] + [InlineData("/fruit:apple", "/", "fruit", "apple")] + [InlineData("--fruit:apple", "--", "fruit", "apple")] + [InlineData("-f:apple", "-", "f", "apple")] + [InlineData("/fruit=apple", "/", "fruit", "apple")] + [InlineData("--fruit=apple", "--", "fruit", "apple")] + [InlineData("-f=apple", "-", "f", "apple")] + [InlineData("/fruit 'apple pear plum'", "/", "fruit", "'apple pear plum'")] + [InlineData("--fruit 'apple pear plum'", "--", "fruit", "'apple pear plum'")] + [InlineData("-f 'apple pear plum'", "-", "f", "'apple pear plum'")] + [InlineData("/fruit:'apple pear plum'", "/", "fruit", "'apple pear plum'")] + [InlineData("--fruit:'apple pear plum'", "--", "fruit", "'apple pear plum'")] + [InlineData("-f:'apple pear plum'", "-", "f", "'apple pear plum'")] + [InlineData("/fruit='apple pear plum'", "/", "fruit", "'apple pear plum'")] + [InlineData("--fruit='apple pear plum'", "--", "fruit", "'apple pear plum'")] + [InlineData("-f='apple pear plum'", "-", "f", "'apple pear plum'")] public void should_parse_single_options_correctly( string arguments, string expectedPrefix, @@ -119,33 +120,33 @@ public void should_parse_single_options_correctly( } [Theory] - [DoubleOptionInlineData("-f -v", "-", "f", null, "-", "v", null)] - [DoubleOptionInlineData("/f /v", "/", "f", null, "/", "v", null)] - [DoubleOptionInlineData("--f --v", "--", "f", null, "--", "v", null)] - [DoubleOptionInlineData("-f apple -v onion", "-", "f", "apple", "-", "v", "onion")] - [DoubleOptionInlineData("/f apple /v onion", "/", "f", "apple", "/", "v", "onion")] - [DoubleOptionInlineData("--f apple --v onion", "--", "f", "apple", "--", "v", "onion")] - [DoubleOptionInlineData("-f -v", "-", "f", null, "-", "v", null)] - [DoubleOptionInlineData("/fruit /vegetable", "/", "fruit", null, "/", "vegetable", null)] - [DoubleOptionInlineData("--fruit --vegetable", "--", "fruit", null, "--", "vegetable", null)] - [DoubleOptionInlineData("/fruit apple /vegetable onion", "/", "fruit", "apple", "/", "vegetable", "onion")] - [DoubleOptionInlineData("--fruit apple --vegetable onion", "--", "fruit", "apple", "--", "vegetable", "onion")] - [DoubleOptionInlineData("-f apple -v onion", "-", "f", "apple", "-", "v", "onion")] - [DoubleOptionInlineData("/fruit:apple /vegetable:onion", "/", "fruit", "apple", "/", "vegetable", "onion")] - [DoubleOptionInlineData("--fruit:apple --vegetable:onion", "--", "fruit", "apple", "--", "vegetable", "onion")] - [DoubleOptionInlineData("-f:apple -v: onion", "-", "f", "apple", "-", "v", "onion")] - [DoubleOptionInlineData("/fruit=apple /vegetable=onion", "/", "fruit", "apple", "/", "vegetable", "onion")] - [DoubleOptionInlineData("--fruit=apple --vegetable=onion", "--", "fruit", "apple", "--", "vegetable", "onion")] - [DoubleOptionInlineData("-f=apple -v=onion", "-", "f", "apple", "-", "v", "onion")] - [DoubleOptionInlineData("/fruit 'apple pear plum' /vegetable 'onion carrot peas'", "/", "fruit", "'apple pear plum'", "/", "vegetable", "'onion carrot peas'")] - [DoubleOptionInlineData("--fruit 'apple pear plum' --vegetable 'onion carrot peas'", "--", "fruit", "'apple pear plum'", "--", "vegetable", "'onion carrot peas'")] - [DoubleOptionInlineData("-f 'apple pear plum' -v 'onion carrot peas'", "-", "f", "'apple pear plum'", "-", "v", "'onion carrot peas'")] - [DoubleOptionInlineData("/fruit:'apple pear plum' /vegetable:'onion carrot peas'", "/", "fruit", "'apple pear plum'", "/", "vegetable", "'onion carrot peas'")] - [DoubleOptionInlineData("--fruit:'apple pear plum' --vegetable:'onion carrot peas'", "--", "fruit", "'apple pear plum'", "--", "vegetable", "'onion carrot peas'")] - [DoubleOptionInlineData("-f:'apple pear plum' -v:'onion carrot peas'", "-", "f", "'apple pear plum'", "-", "v", "'onion carrot peas'")] - [DoubleOptionInlineData("/fruit='apple pear plum' /vegetable='onion carrot peas'", "/", "fruit", "'apple pear plum'", "/", "vegetable", "'onion carrot peas'")] - [DoubleOptionInlineData("--fruit='apple pear plum' --vegetable='onion carrot peas'", "--", "fruit", "'apple pear plum'", "--", "vegetable", "'onion carrot peas'")] - [DoubleOptionInlineData("-f='apple pear plum' -v='onion carrot peas'", "-", "f", "'apple pear plum'", "-", "v", "'onion carrot peas'")] + [InlineData("-f -v", "-", "f", null, "-", "v", null)] + [InlineData("/f /v", "/", "f", null, "/", "v", null)] + [InlineData("--f --v", "--", "f", null, "--", "v", null)] + [InlineData("-f apple -v onion", "-", "f", "apple", "-", "v", "onion")] + [InlineData("/f apple /v onion", "/", "f", "apple", "/", "v", "onion")] + [InlineData("--f apple --v onion", "--", "f", "apple", "--", "v", "onion")] + [InlineData("-f -v", "-", "f", null, "-", "v", null)] + [InlineData("/fruit /vegetable", "/", "fruit", null, "/", "vegetable", null)] + [InlineData("--fruit --vegetable", "--", "fruit", null, "--", "vegetable", null)] + [InlineData("/fruit apple /vegetable onion", "/", "fruit", "apple", "/", "vegetable", "onion")] + [InlineData("--fruit apple --vegetable onion", "--", "fruit", "apple", "--", "vegetable", "onion")] + [InlineData("-f apple -v onion", "-", "f", "apple", "-", "v", "onion")] + [InlineData("/fruit:apple /vegetable:onion", "/", "fruit", "apple", "/", "vegetable", "onion")] + [InlineData("--fruit:apple --vegetable:onion", "--", "fruit", "apple", "--", "vegetable", "onion")] + [InlineData("-f:apple -v: onion", "-", "f", "apple", "-", "v", "onion")] + [InlineData("/fruit=apple /vegetable=onion", "/", "fruit", "apple", "/", "vegetable", "onion")] + [InlineData("--fruit=apple --vegetable=onion", "--", "fruit", "apple", "--", "vegetable", "onion")] + [InlineData("-f=apple -v=onion", "-", "f", "apple", "-", "v", "onion")] + [InlineData("/fruit 'apple pear plum' /vegetable 'onion carrot peas'", "/", "fruit", "'apple pear plum'", "/", "vegetable", "'onion carrot peas'")] + [InlineData("--fruit 'apple pear plum' --vegetable 'onion carrot peas'", "--", "fruit", "'apple pear plum'", "--", "vegetable", "'onion carrot peas'")] + [InlineData("-f 'apple pear plum' -v 'onion carrot peas'", "-", "f", "'apple pear plum'", "-", "v", "'onion carrot peas'")] + [InlineData("/fruit:'apple pear plum' /vegetable:'onion carrot peas'", "/", "fruit", "'apple pear plum'", "/", "vegetable", "'onion carrot peas'")] + [InlineData("--fruit:'apple pear plum' --vegetable:'onion carrot peas'", "--", "fruit", "'apple pear plum'", "--", "vegetable", "'onion carrot peas'")] + [InlineData("-f:'apple pear plum' -v:'onion carrot peas'", "-", "f", "'apple pear plum'", "-", "v", "'onion carrot peas'")] + [InlineData("/fruit='apple pear plum' /vegetable='onion carrot peas'", "/", "fruit", "'apple pear plum'", "/", "vegetable", "'onion carrot peas'")] + [InlineData("--fruit='apple pear plum' --vegetable='onion carrot peas'", "--", "fruit", "'apple pear plum'", "--", "vegetable", "'onion carrot peas'")] + [InlineData("-f='apple pear plum' -v='onion carrot peas'", "-", "f", "'apple pear plum'", "-", "v", "'onion carrot peas'")] public void should_parse_double_options_correctly( string arguments, string firstExpectedKeyChar, diff --git a/FluentCommandLineParser.Tests/Internals/Errors/ExpectedOptionNotFoundParseErrorTests.cs b/FluentCommandLineParser.Tests/Internals/Errors/ExpectedOptionNotFoundParseErrorTests.cs index cfa6685..c42bfb1 100644 --- a/FluentCommandLineParser.Tests/Internals/Errors/ExpectedOptionNotFoundParseErrorTests.cs +++ b/FluentCommandLineParser.Tests/Internals/Errors/ExpectedOptionNotFoundParseErrorTests.cs @@ -25,27 +25,27 @@ #endregion using System; -using NUnit.Framework; +using Fclp.Internals; +using Fclp.Internals.Errors; using Moq; +using Xunit; namespace FluentCommandLineParser.Internals.Errors { - [TestFixture] public class ExpectedOptionNotFoundParseErrorTests { - [Test] + [Fact] public void Ensure_Can_Be_Constructed() { var cmdOption = Mock.Of(); var snfError = new ExpectedOptionNotFoundParseError(cmdOption); - Assert.AreSame(cmdOption, snfError.Option); + Assert.Same(cmdOption, snfError.Option); } - [Test] - [ExpectedException(typeof(ArgumentNullException))] + [Fact] public void Ensure_Cannot_Specify_Null_option() { - new ExpectedOptionNotFoundParseError(null); + Assert.Throws( () => new ExpectedOptionNotFoundParseError(null)); } } } diff --git a/FluentCommandLineParser.Tests/Internals/TestContextBase.cs b/FluentCommandLineParser.Tests/Internals/TestContextBase.cs index 06f64aa..7d94fb0 100644 --- a/FluentCommandLineParser.Tests/Internals/TestContextBase.cs +++ b/FluentCommandLineParser.Tests/Internals/TestContextBase.cs @@ -28,8 +28,8 @@ using Fclp.Internals.Extensions; using Machine.Specifications; using Moq; -using Ploeh.AutoFixture; -using Ploeh.AutoFixture.AutoMoq; +using AutoFixture; +using AutoFixture.AutoMoq; namespace Fclp.Tests.Internals { diff --git a/FluentCommandLineParser.Tests/Internals/Validators/OptionNameValidatorTests.cs b/FluentCommandLineParser.Tests/Internals/Validators/OptionNameValidatorTests.cs index 9ad9e8a..cf3946f 100644 --- a/FluentCommandLineParser.Tests/Internals/Validators/OptionNameValidatorTests.cs +++ b/FluentCommandLineParser.Tests/Internals/Validators/OptionNameValidatorTests.cs @@ -75,7 +75,7 @@ class when_the_short_name_is_whitespace : ValidateTestContext Establish context = () => SetupOptionWith(shortName: " "); - It should_throw_an_error = () => error.ShouldBeOfType(); + It should_throw_an_error = () => error.ShouldBeOfExactType(); } class when_the_short_name_contains_a_colon : ValidateTestContext @@ -83,7 +83,7 @@ class when_the_short_name_contains_a_colon : ValidateTestContext Establish context = () => SetupOptionWith(shortName: ":"); - It should_throw_an_error = () => error.ShouldBeOfType(); + It should_throw_an_error = () => error.ShouldBeOfExactType(); } class when_the_short_name_contains_an_equality_sign : ValidateTestContext @@ -91,7 +91,7 @@ class when_the_short_name_contains_an_equality_sign : ValidateTestContext Establish context = () => SetupOptionWith(shortName: "="); - It should_throw_an_error = () => error.ShouldBeOfType(); + It should_throw_an_error = () => error.ShouldBeOfExactType(); } class when_the_short_name_is_empty : ValidateTestContext @@ -107,7 +107,7 @@ class when_the_short_name_is_a_control_char : ValidateTestContext Establish context = () => SetupOptionWith(shortName: ((char)7).ToString(CultureInfo.InvariantCulture)); - It should_throw_an_error = () => error.ShouldBeOfType(); + It should_throw_an_error = () => error.ShouldBeOfExactType(); } class when_the_short_name_is_longer_than_one_char : ValidateTestContext @@ -115,7 +115,7 @@ class when_the_short_name_is_longer_than_one_char : ValidateTestContext Establish context = () => SetupOptionWith(shortName: CreateStringOfLength(2)); - It should_throw_an_error = () => error.ShouldBeOfType(); + It should_throw_an_error = () => error.ShouldBeOfExactType(); } class when_the_short_name_is_one_char : ValidateTestContext @@ -139,7 +139,7 @@ class when_the_long_name_is_whitespace : ValidateTestContext Establish context = () => SetupOptionWith(longName: " "); - It should_throw_an_error = () => error.ShouldBeOfType(); + It should_throw_an_error = () => error.ShouldBeOfExactType(); } class when_the_long_name_contains_a_colon : ValidateTestContext @@ -147,7 +147,7 @@ class when_the_long_name_contains_a_colon : ValidateTestContext Establish context = () => SetupOptionWith(longName: ValidLongName + ":"); - It should_throw_an_error = () => error.ShouldBeOfType(); + It should_throw_an_error = () => error.ShouldBeOfExactType(); } class when_the_long_name_contains_an_equality_sign : ValidateTestContext @@ -155,7 +155,7 @@ class when_the_long_name_contains_an_equality_sign : ValidateTestContext Establish context = () => SetupOptionWith(longName: ValidLongName + "="); - It should_throw_an_error = () => error.ShouldBeOfType(); + It should_throw_an_error = () => error.ShouldBeOfExactType(); } class when_the_long_name_is_empty : ValidateTestContext @@ -179,7 +179,7 @@ class when_the_long_name_is_one_char : ValidateTestContext Establish context = () => SetupOptionWith(longName: CreateStringOfLength(1)); - It should_throw_a_too_long_error = () => error.ShouldBeOfType(); + It should_throw_a_too_long_error = () => error.ShouldBeOfExactType(); } class when_the_long_name_contains_whitespace: ValidateTestContext @@ -187,7 +187,7 @@ class when_the_long_name_contains_whitespace: ValidateTestContext Establish context = () => SetupOptionWith(longName: ValidLongName + " " + ValidLongName); - It should_throw_an_error = () => error.ShouldBeOfType(); + It should_throw_an_error = () => error.ShouldBeOfExactType(); } class when_the_long_name_is_null_and_the_short_name_is_null : ValidateTestContext @@ -195,7 +195,7 @@ class when_the_long_name_is_null_and_the_short_name_is_null : ValidateTestContex Establish context = () => SetupOptionWith(shortName: null, longName: null); - It should_throw_an_error = () => error.ShouldBeOfType(); + It should_throw_an_error = () => error.ShouldBeOfExactType(); } class when_the_long_name_is_empty_and_the_short_name_is_empty : ValidateTestContext @@ -203,7 +203,7 @@ class when_the_long_name_is_empty_and_the_short_name_is_empty : ValidateTestCont Establish context = () => SetupOptionWith(shortName: string.Empty, longName: string.Empty); - It should_throw_an_error = () => error.ShouldBeOfType(); + It should_throw_an_error = () => error.ShouldBeOfExactType(); } } } diff --git a/FluentCommandLineParser.Tests/Mspec/CommandLineParserEngine/TestContext/CommandLineParserEngineTestContext.cs b/FluentCommandLineParser.Tests/Mspec/CommandLineParserEngine/TestContext/CommandLineParserEngineTestContext.cs index 06833dc..b33eecc 100644 --- a/FluentCommandLineParser.Tests/Mspec/CommandLineParserEngine/TestContext/CommandLineParserEngineTestContext.cs +++ b/FluentCommandLineParser.Tests/Mspec/CommandLineParserEngine/TestContext/CommandLineParserEngineTestContext.cs @@ -29,12 +29,12 @@ using System.Linq; using FluentCommandLineParser.Internals; using Machine.Specifications; - +/* namespace FluentCommandLineParser.Tests { namespace CommandLineParserEngineTests { - [Subject(typeof(CommandLineParserEngine), "CommandLineParserEngine")] + [Subject(typeof(CommandLineParserEngineMark2), "CommandLineParserEngine")] public abstract class CommandLineParserEngineTestContext { protected static Exception error; @@ -50,4 +50,4 @@ protected static void RunParserWith(string[] args) } } } -} \ No newline at end of file +} */ \ No newline at end of file diff --git a/FluentCommandLineParser.Tests/Properties/AssemblyInfo.cs b/FluentCommandLineParser.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 630d201..0000000 --- a/FluentCommandLineParser.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,53 +0,0 @@ -#region License -// AssemblyInfo.cs -// Copyright (c) 2013, Simon Williams -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, are permitted provide -// d that the following conditions are met: -// -// Redistributions of source code must retain the above copyright notice, this list of conditions and the -// following disclaimer. -// -// Redistributions in binary form must reproduce the above copyright notice, this list of conditions and -// the following disclaimer in the documentation and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FluentCommandLineParser.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FluentCommandLineParser")] -[assembly: AssemblyCopyright("Copyright © Simon Williams 2012 - 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: CLSCompliant(true)] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("9dc00720-9d8b-4315-974b-395feb71e827")] - -// !! DO NOT CHANGE - VERSIONS ARE HANDLED AUTOMATICALLY FROM THE CONTINUOUS INTEGRATION SERVER!! -[assembly: AssemblyVersion("0.0.0.0")] -[assembly: AssemblyFileVersion("0.0.0.0")] - diff --git a/FluentCommandLineParser.Tests/UriTests.cs b/FluentCommandLineParser.Tests/UriTests.cs index 428b55f..fdc1cca 100644 --- a/FluentCommandLineParser.Tests/UriTests.cs +++ b/FluentCommandLineParser.Tests/UriTests.cs @@ -2,14 +2,13 @@ using System.Collections.Generic; using System.Linq; using Fclp.Internals.Extensions; -using NUnit.Framework; +using Xunit; namespace Fclp.Tests { /// /// Tests for Uris /// - [TestFixture] public class UriTests { public class ExampleArgsContainer @@ -18,7 +17,7 @@ public class ExampleArgsContainer public Uri Uri { get; set; } } - [Test] + [Fact] public void GenericFclp_UriAsString() { const char shortKey = 'u'; @@ -36,13 +35,13 @@ public void GenericFclp_UriAsString() var result = fclp.Parse(combination.Args); - Assert.IsEmpty(result.Errors); - Assert.IsEmpty(result.AdditionalOptionsFound); - Assert.AreEqual(uri, fclp.Object.UriAsString); + Assert.Empty(result.Errors); + Assert.Empty(result.AdditionalOptionsFound); + Assert.Equal(uri, fclp.Object.UriAsString); } } - [Test] + [Fact] public void StandardFclp_UriAsString() { const char shortKey = 'u'; @@ -59,13 +58,13 @@ public void StandardFclp_UriAsString() var result = fclp.Parse(combination.Args); - Assert.IsEmpty(result.Errors); - Assert.IsEmpty(result.AdditionalOptionsFound); - Assert.AreEqual(uri, uriAsString); + Assert.Empty(result.Errors); + Assert.Empty(result.AdditionalOptionsFound); + Assert.Equal(uri, uriAsString); } } - [Test] + [Fact] public void GenericFclp_Uri() { const char shortKey = 'u'; @@ -83,13 +82,13 @@ public void GenericFclp_Uri() var result = fclp.Parse(combination.Args); - Assert.IsEmpty(result.Errors); - Assert.IsEmpty(result.AdditionalOptionsFound); - Assert.AreEqual(uri, fclp.Object.Uri.AbsoluteUri); + Assert.Empty(result.Errors); + Assert.Empty(result.AdditionalOptionsFound); + Assert.Equal(uri, fclp.Object.Uri.AbsoluteUri); } } - [Test] + [Fact] public void StandardFclp_Uri() { const char shortKey = 'u'; @@ -106,9 +105,9 @@ public void StandardFclp_Uri() var result = fclp.Parse(combination.Args); - Assert.IsEmpty(result.Errors); - Assert.IsEmpty(result.AdditionalOptionsFound); - Assert.AreEqual(uri, actualUri.AbsoluteUri); + Assert.Empty(result.Errors); + Assert.Empty(result.AdditionalOptionsFound); + Assert.Equal(uri, actualUri.AbsoluteUri); } } diff --git a/FluentCommandLineParser.Tests/app.config b/FluentCommandLineParser.Tests/app.config deleted file mode 100644 index 3415220..0000000 --- a/FluentCommandLineParser.Tests/app.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/FluentCommandLineParser.Tests/packages.config b/FluentCommandLineParser.Tests/packages.config deleted file mode 100644 index 49f23ad..0000000 --- a/FluentCommandLineParser.Tests/packages.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/FluentCommandLineParser.sln b/FluentCommandLineParser.sln index 601837a..836f7b9 100644 --- a/FluentCommandLineParser.sln +++ b/FluentCommandLineParser.sln @@ -1,10 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCommandLineParser", "FluentCommandLineParser\FluentCommandLineParser.csproj", "{74CDFA61-81D8-40F2-B536-949BABA15D3E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCommandLineParser.Tests", "FluentCommandLineParser.Tests\FluentCommandLineParser.Tests.csproj", "{A2546703-0B86-4515-BE5B-FAF85B756BDC}" -EndProject +# Visual Studio 14 +VisualStudioVersion = 14.0.25123.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{D8DCB1C2-5F18-4F40-A583-723975F89C1A}" ProjectSection(SolutionItems) = preProject .nuget\NuGet.Config = .nuget\NuGet.Config @@ -12,22 +10,36 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{D8DCB1 .nuget\NuGet.targets = .nuget\NuGet.targets EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D99A89F2-12E3-402E-8E3A-9EFAFCF2BC76}" + ProjectSection(SolutionItems) = preProject + global.json = global.json + LICENCE.txt = LICENCE.txt + README.md = README.md + .gitignore = .gitignore + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCommandLineParser", "FluentCommandLineParser\FluentCommandLineParser.csproj", "{BD83873B-353B-4742-AA1A-C93F6A279021}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCommandLineParser.Tests", "FluentCommandLineParser.Tests\FluentCommandLineParser.Tests.csproj", "{9F46727C-533F-40D5-A59B-062C57F36B19}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {74CDFA61-81D8-40F2-B536-949BABA15D3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {74CDFA61-81D8-40F2-B536-949BABA15D3E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {74CDFA61-81D8-40F2-B536-949BABA15D3E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {74CDFA61-81D8-40F2-B536-949BABA15D3E}.Release|Any CPU.Build.0 = Release|Any CPU - {A2546703-0B86-4515-BE5B-FAF85B756BDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A2546703-0B86-4515-BE5B-FAF85B756BDC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A2546703-0B86-4515-BE5B-FAF85B756BDC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A2546703-0B86-4515-BE5B-FAF85B756BDC}.Release|Any CPU.Build.0 = Release|Any CPU + {BD83873B-353B-4742-AA1A-C93F6A279021}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD83873B-353B-4742-AA1A-C93F6A279021}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD83873B-353B-4742-AA1A-C93F6A279021}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BD83873B-353B-4742-AA1A-C93F6A279021}.Release|Any CPU.Build.0 = Release|Any CPU + {9F46727C-533F-40D5-A59B-062C57F36B19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9F46727C-533F-40D5-A59B-062C57F36B19}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9F46727C-533F-40D5-A59B-062C57F36B19}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9F46727C-533F-40D5-A59B-062C57F36B19}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + EndGlobalSection EndGlobal diff --git a/FluentCommandLineParser/FluentCommandLineParser.csproj b/FluentCommandLineParser/FluentCommandLineParser.csproj index 2d395aa..e42bc7c 100644 --- a/FluentCommandLineParser/FluentCommandLineParser.csproj +++ b/FluentCommandLineParser/FluentCommandLineParser.csproj @@ -1,130 +1,7 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {74CDFA61-81D8-40F2-B536-949BABA15D3E} - Library - Properties - Fclp - FluentCommandLineParser - v3.5 - 512 - Client - ..\ - - - true - full - false - bin\debug\ - DEBUG;TRACE - prompt - 4 - bin\debug\FluentCommandLineParser.xml - true - true - AllRules.ruleset - - - pdbonly - true - bin\release\ - TRACE - prompt - 4 - bin\release\FluentCommandLineParser.xml - true - true - AllRules.ruleset - - - false - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + netstandard2.0; + + + diff --git a/FluentCommandLineParser/FluentCommandLineParser.nuspec b/FluentCommandLineParser/FluentCommandLineParser.nuspec deleted file mode 100644 index bec217d..0000000 --- a/FluentCommandLineParser/FluentCommandLineParser.nuspec +++ /dev/null @@ -1,23 +0,0 @@ - - - - FluentCommandLineParser - Fluent Command Line Parser - $version$ - siywilliams - siywilliams - http://fclp.github.com/fluent-command-line-parser - false - A simple, strongly typed .NET C# command line parser library using a fluent easy to use interface - https://github.com/fclp/fluent-command-line-parser/wiki/Release-Notes - Copyright Simon Williams 2012 - 2013 - fluent command line parser commandline c# net35 - - - - - - - - - \ No newline at end of file diff --git a/FluentCommandLineParser/Internals/Parsing/OptionParsers/CommandLineOptionParserFactory.cs b/FluentCommandLineParser/Internals/Parsing/OptionParsers/CommandLineOptionParserFactory.cs index 3b539d7..e27ddd9 100644 --- a/FluentCommandLineParser/Internals/Parsing/OptionParsers/CommandLineOptionParserFactory.cs +++ b/FluentCommandLineParser/Internals/Parsing/OptionParsers/CommandLineOptionParserFactory.cs @@ -58,7 +58,7 @@ public CommandLineOptionParserFactory() this.AddOrReplace(new NullableCommandLineOptionParser(this)); } - internal Dictionary Parsers { get; set; } + public Dictionary Parsers { get; set; } /// /// Adds the specified to this factories list of supported parsers. diff --git a/FluentCommandLineParser/Properties/AssemblyInfo.cs b/FluentCommandLineParser/Properties/AssemblyInfo.cs deleted file mode 100644 index dd679cd..0000000 --- a/FluentCommandLineParser/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -#region License -// AssemblyInfo.cs -// Copyright (c) 2013, Simon Williams -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, are permitted provide -// d that the following conditions are met: -// -// Redistributions of source code must retain the above copyright notice, this list of conditions and the -// following disclaimer. -// -// Redistributions in binary form must reproduce the above copyright notice, this list of conditions and -// the following disclaimer in the documentation and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Fluent Command Line Parser")] -[assembly: AssemblyDescription("A simple, strongly typed .NET C# command line parser library using a fluent easy to use interface.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Fluent Command Line Parser")] -[assembly: AssemblyCopyright("Copyright © Simon Williams 2012 - 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: CLSCompliant(true)] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("b563a988-ae88-4bcc-b6ab-e167f941a167")] - -// Allows us to unit test the 'internals' -//[assembly: InternalsVisibleTo("FluentCommandLineParser.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ad2e88658ff62cac7d7ececd3ac22c6d39ee4e19a09d61acae936f9497df38fa3db020d2b607c8176cd754c7e3a8cdc10559bedcbaaeed76e277f0d009b39bab687261567a1f2da2c3d63b913822ee944664e29bcb85d6b49b87c7d6ee44647ec5252379ed5e4c09d787f6753cf2fdf4a1c1890eedc655738d466bb6f3b91396")] -[assembly: InternalsVisibleTo("FluentCommandLineParser.Tests")] -// !! DO NOT CHANGE - VERSIONS ARE HANDLED AUTOMATICALLY FROM THE CONTINUOUS INTEGRATION SERVER!! -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/global.json b/global.json new file mode 100644 index 0000000..d78a284 --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "projects": [ "Core"], + "sdk": { + "version": "2.1.403" + } +} \ No newline at end of file