Skip to content

Commit

Permalink
command parser now works on private property setters
Browse files Browse the repository at this point in the history
  • Loading branch information
aarkegz committed Oct 11, 2020
1 parent 5be91c4 commit 9943db6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions XUnitTester/DefaultStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public string OptionA {
}

[ShortOption('b')]
public bool OptionB {
private bool OptionB {
set => Logs.Enqueue($"B:{value}");
}

[LongOption("bravo")]
public void OptionBPlus() => Logs.Enqueue($"B:{true}");

[ShortOption('c', OptionParameter.Required)]
public void OptionC(string value) => Logs.Enqueue($"C:{value}");
private void OptionC(string value) => Logs.Enqueue($"C:{value}");

[ShortOption('d', OptionParameter.Optional)]
[LongOption("delta", OptionParameter.Optional)]
Expand All @@ -34,7 +34,7 @@ public string OptionD {

[ShortOption('e', OptionParameter.Optional)]
[LongOption("echo", OptionParameter.Required)]
public string OptionE {
private string OptionE {
set => Logs.Enqueue($"E:{value ?? "default"}");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void SetProperty<T>(PropertyInfo property, object target, T value)
Assert(property.CanWrite);
Assert(property.PropertyType.IsAssignableFrom(typeof(T)));

property.GetSetMethod().Invoke(target, new object?[] { value });
property.GetSetMethod(true).Invoke(target, new object?[] { value });
}

public static void SetField<T>(FieldInfo field, object target, T value) {
Expand Down

0 comments on commit 9943db6

Please sign in to comment.