-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WithNotParsed() not being called during test #424
Comments
I created a vs2017 Test project as multi-target in net461 and netcoreapp2.1 using your test cases and used commanslineparser v2.4.3 I modified the code of
The HandleParseError function is called in both net461 and netcoreapp2.1 and raise the exception:
The try ..catch in the method Try it and let me know if it's not working as you expect. |
@shyassure |
@moh-hassan Sorry I haven't replied or tried without try catch. I've been working on other projects that doesn't use this library meanwhile. I will let you know if the issue is resolved. |
Doesn't seem like v2.5.0 solves the issue. |
When you catch the Exception in
You get the following exception:
So, WithNotParsed exception is fired and catched by try .. catch To catch the NotImplementedException Exception of in HandleParseError , remove try ..catch and run the test:
And the test pass successfully |
When running a test and command line parser inside a unit test, the HandleParseError function is never being called. I created a gist with a test and a class showing the example.
If I execute the class using regular F5 debugging inside Visual Studio, the HandleParseError function will be called.
https://gist.github.com/shyassure/78fcb2e5a497d2d266f44f579e0c37d3
The text was updated successfully, but these errors were encountered: