-
Notifications
You must be signed in to change notification settings - Fork 253
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
Can't implement ISettings #7614
Comments
I went the easy route and used reflection for creating an instance of |
@PatoBeltran can you help here? |
hey @mholo65 I was looking into this, the idea is that if you want to implement I see that for your case you only want to mock it for testing purposes. From what I see there could be two options in how to solve this:
I think the best solution out of the two would be the first one, and that way you could easily subclass |
@PatoBeltran, thanks for looking into this. Option 1) making it public is probably the best option. Want me to send a PR? |
@mholo65 if you can send a PR I would appreciate it! |
hey @mholo65 I sent a PR to fix this, I would appreciate if you can look at it and see if it would address your scenario. Thanks for helping us improve our codebase! |
PR has been merged, closing this issue. |
@PatoBeltran thank you! This looks to solve the problem I was experiencing! |
I'm using the NuGet client libraries in a application, and now I need to write some tests. I've previously mocked
ISettings
quite easily. But now, when updating from4.7.0
to4.9.1
I've run into a problem withISettings
.The problem:
I need to implement method
SettingSection GetSection(string sectionName);
SettingSection
inherits fromSettingsBase
.[
SettingsBase
] defines an abstract internal methodClone()
... https://github.com/NuGet/NuGet.Client/blob/release-4.9.1-rtm/src/NuGet.Core/NuGet.Configuration/Settings/SettingBase.cs#L53... I can't override that, because it'sinternal
.I could have used
VirtualSettingSection
, which your tests use. It's a public class, but it only has internal constructors....Please advice... How to implement
ISettings
and specificallySettingSection
using NuGet Client libraries. Thank you!The text was updated successfully, but these errors were encountered: