Skip to content
This repository was archived by the owner on Feb 23, 2025. It is now read-only.

Make non virtual properties virtual to enable mocking #69

Merged
merged 3 commits into from Jun 24, 2018
Merged

Make non virtual properties virtual to enable mocking #69

merged 3 commits into from Jun 24, 2018

Conversation

jabba2324
Copy link
Contributor

When using a mocking framework like moq the properties of some request & reponse models cannot be overridden.

For example:

_loginResult = new Mock<LoginResult>();
_loginResult.SetupGet(r => r.AccessToken).Returns("my token");

Throws:
System.NotSupportedException : Invalid setup on a non-virtual (overridable in VB) member: r => r.AccessToken

Making these properties virtual should enable this with no side effects.

@jabba2324 jabba2324 mentioned this pull request Jun 22, 2018
@leastprivilege
Copy link
Contributor

I think I prefer that over the interface

@jabba2324
Copy link
Contributor Author

jabba2324 commented Jun 22, 2018

@leastprivilege ok let me add the client class to this PR, done.

@leastprivilege
Copy link
Contributor

OK - thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants