From b27cb7e4820d8a0b3fb72aa0f081ee55f183d675 Mon Sep 17 00:00:00 2001 From: "Moh.Hassan" Date: Fri, 26 Apr 2019 20:24:04 +0200 Subject: [PATCH 1/3] Revert "fixed bad merge of Error.cs in build" (6d2dc12f0) --- src/CommandLine/Error.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/CommandLine/Error.cs b/src/CommandLine/Error.cs index 90ee26d8..b1bc3e94 100644 --- a/src/CommandLine/Error.cs +++ b/src/CommandLine/Error.cs @@ -64,8 +64,7 @@ public enum ErrorType /// /// Value of type. /// - SetValueExceptionError, - + SetValueExceptionError VersionRequestedError, /// /// Value of type. From 6a6015eb25795d925e852cbe1fb88d9ccafdba55 Mon Sep 17 00:00:00 2001 From: "Moh.Hassan" Date: Fri, 26 Apr 2019 20:25:50 +0200 Subject: [PATCH 2/3] Revert "Merge branch 'develop' of github.com:commandlineparser/commandline into develop" (5343c5d, reversing changes 9f91088) --- src/CommandLine/Core/ReflectionExtensions.cs | 13 ------------- src/CommandLine/Error.cs | 5 ----- .../Fakes/Options_With_InvalidDefaults.cs | 11 ----------- .../Unit/Core/InstanceBuilderTests.cs | 17 +---------------- 4 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 tests/CommandLine.Tests/Fakes/Options_With_InvalidDefaults.cs diff --git a/src/CommandLine/Core/ReflectionExtensions.cs b/src/CommandLine/Core/ReflectionExtensions.cs index 2f4faf0f..cd75e07e 100644 --- a/src/CommandLine/Core/ReflectionExtensions.cs +++ b/src/CommandLine/Core/ReflectionExtensions.cs @@ -14,8 +14,6 @@ namespace CommandLine.Core { static class ReflectionExtensions { - public const string CannotSetValueToTargetInstance = "Cannot set value to target instance."; - public static IEnumerable GetSpecifications(this Type type, Func selector) { return from pi in type.FlattenHierarchy().SelectMany(x => x.GetTypeInfo().GetProperties()) @@ -93,10 +91,6 @@ public static TargetType ToTargetType(this Type type) private static IEnumerable SetValue(this SpecificationProperty specProp, T instance, object value) { - Action fail = inner => { - throw new InvalidOperationException(CannotSetValueToTargetInstance, inner); - }; - try { specProp.Property.SetValue(instance, value, null); @@ -110,13 +104,6 @@ private static IEnumerable SetValue(this SpecificationProperty specPro { return new[] { new SetValueExceptionError(specProp.Specification.FromSpecification(), e, value) }; } - catch(ArgumentException e) - { - var argEx = new ArgumentException(InvalidAttributeConfigurationError.ErrorMessage, e); - fail(argEx); - } - - return instance; } public static object CreateEmptyArray(this Type type) diff --git a/src/CommandLine/Error.cs b/src/CommandLine/Error.cs index b1bc3e94..2b586912 100644 --- a/src/CommandLine/Error.cs +++ b/src/CommandLine/Error.cs @@ -65,11 +65,6 @@ public enum ErrorType /// Value of type. /// SetValueExceptionError - VersionRequestedError, - /// - /// Value of type. - /// - InvalidAttributeConfigurationError } /// diff --git a/tests/CommandLine.Tests/Fakes/Options_With_InvalidDefaults.cs b/tests/CommandLine.Tests/Fakes/Options_With_InvalidDefaults.cs deleted file mode 100644 index cedb1136..00000000 --- a/tests/CommandLine.Tests/Fakes/Options_With_InvalidDefaults.cs +++ /dev/null @@ -1,11 +0,0 @@ - -namespace CommandLine.Tests.Fakes -{ - class Options_With_InvalidDefaults - { - // Default of string and integer type property will also throw. - - [Option(Default = false)] - public string FileName { get; set; } - } -} diff --git a/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs b/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs index eef9a674..c150d23a 100644 --- a/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs +++ b/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs @@ -1133,21 +1133,6 @@ public void Parse_TimeSpan() // Teardown } - [Fact] - public void Build_DefaultBoolTypeString_ThrowsInvalidOperationException() - { - // Exercize system - Action test = () => InvokeBuild( - new string[] { }); - - // Verify outcome - test.ShouldThrow() - .WithMessage(ReflectionExtensions.CannotSetValueToTargetInstance) - .WithInnerException() - .WithInnerMessage(InvalidAttributeConfigurationError.ErrorMessage); - } - - [Fact] public void OptionClass_IsImmutable_HasNoCtor() { @@ -1163,7 +1148,7 @@ private class ValueWithNoSetterOptions } - public static IEnumerable RequiredValueStringData + public static IEnumerable RequiredValueStringData { get { From 28d1376ad1a1f5cce25445cc7251c9744acdd70c Mon Sep 17 00:00:00 2001 From: "Moh.Hassan" Date: Fri, 26 Apr 2019 22:07:15 +0200 Subject: [PATCH 3/3] resolving appveyor build error --- CommandLine.snk | Bin 595 -> 596 bytes appveyor.yml | 2 +- src/CommandLine/CommandLine.csproj | 1 + src/CommandLine/Properties/AssemblyInfo.cs | 2 +- 4 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CommandLine.snk b/CommandLine.snk index 96087a731df6b418f70cfe6df405afeb53af9025..6b0b650111ad1ef405aa994d57732ff390e61643 100644 GIT binary patch delta 587 zcmV-R0<`_p1k?nO6n_b;B=3lv(rff@ey-Xm;QCwy#SD|i;UP176-&wrAJvM+%Z3?S zaGW6^^n!B??F69VXQg$HR?|jH`nvuCD=|?FIi?wC{pXcP4b~58IbapV_L`I+bfffT zOKsL|3}ax6>Uh2RYc;X7i?>%n!pf~5a95uwZymfWRs|8pNPp7%=L0Lq+9^7rEYzH1 zb@{H&4fIh%1A#Be9PBmhieJHVSOpkXK{`l6Zkiqvf zUcRWtL48wl7#Xzb_yk#A6%05p-l_%I6f)mJ1n0J6kLcmEP&8%^B zfHQZ&FhufHlor{V_H_)BX!P!}h6{*et5iy&Xr@NSzz+GKvhPVu0vD2Ya^gx`v<6kYi+V$6dn=DR; z3xyNavf()^Du2$m5!)`rG9pe90Qr(rr`&n6Hg7mO{we0^4%`~!U@yK2eSDpk_-g}d zug^~rk5qh2!QC@_&G;YFDY*E$El3}nIWf4gGLr+t%X1n9fovdLPQ^+})N#3*cyRmr zyuWpl43ire`CXHd2*=^2iP(&JCOBMEBmKCT-q@SNpMR$_HvZf*?{z*zU_|RnE=c)7 z^V$RgVKR}ENDOzv39QEk^RC$p!FH1XR(Z&`kQ4TD$zc`WS@J%T$3?$HvCG>S27yE; zSVgj8M^qyZKp0P%+@LP&0%1ZGa$(DefineConstants);SKIP_FSHARP true ..\..\CommandLine.snk + true CommandLineParser CommandLineParser.FSharp diff --git a/src/CommandLine/Properties/AssemblyInfo.cs b/src/CommandLine/Properties/AssemblyInfo.cs index 4b4532b3..1dc94d20 100644 --- a/src/CommandLine/Properties/AssemblyInfo.cs +++ b/src/CommandLine/Properties/AssemblyInfo.cs @@ -2,4 +2,4 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("CommandLine.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010015eb7571d696c075627830f9468969103bc35764467bdbccfc0850f2fbe6913ee233d5d7cf3bbcb870fd42e6a8cc846d706b5cef35389e5b90051991ee8b6ed73ee1e19f108e409be69af6219b2e31862405f4b8ba101662fbbb54ba92a35d97664fe65c90c2bebd07aef530b01b709be5ed01b7e4d67a6b01c8643e42a20fb4")] +[assembly: InternalsVisibleTo("CommandLine.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010009ab24ef889cd26bf46f7eaeda28e0fa5c04c50c93c6e121337b154bca0a1fd58ac6cb86195b709c2120f482730ced04a0e167a5758e56d3464bfabafe022b31510c39a61968fde795480dd60f6a396015c5f69a942074a3f4654b6dd66d0c63608bea78bdf96b35b1b48bb75741c2caad1f70579f286f1dbc2c560511c648d2")]