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
[Question] Tested code overwites property setup #584
Comments
Thanks for the question @Vraiment. I can't think of any good ways around this sorry. Only idea I could come up with so far is changing Sorry I can't be of more help. |
Thanks for the answer David, this sounds like a major limitation for the library as it means if you are substituting a read/write property the code you are testing can't write to the property, and changing the interface as you suggest means changing application code for the sake of testing which is not a good idea. For my particular case what I did was abstract this operation to an Anyway, aside from this working with NSubstitute has been great! Thanks for your hard work and hopefully there is a formal solution for this problem later down the line. |
@Vraiment Thank you for an interesting issue. I second @dtchepak the example is entangled (involves state, ordered execution and assertion). The most important piece is that it has expectations for the interface implementation. The interface itself doesn't guarantee that if you It's better to use other types of test doubles, namely
In that case you can code your assumptions and expectations for the interface. Hope it helps. |
I have a problem where:
Here is a very condensed example of my issue
The problem are the lines
interface.Value = originalValue
insideCodeUnderTest
overwrite the setup in the test. Is there a workaround for this?The text was updated successfully, but these errors were encountered: