-
Notifications
You must be signed in to change notification settings - Fork 7
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
False positive NS1004 with When().Do()
#160
Comments
I also tried to test that a property was not set using the following, which doesn't use using NUnit.Framework;
using NSubstitute;
namespace dlsfkn
{
public interface IFoo
{
string Foo { set; }
}
public class Tests
{
[Test]
public void Test1()
{
var foo = NSubstitute.Substitute.For<IFoo>();
foo.Foo = "whynot";
foo.DidNotReceive().Foo = Arg.Any<string>();
}
}
}
What would you recommend instead to test that a property is not set? |
@tpodolak I haven't expected that use but it seems like it is valid.
@mcarton If possible I think asserting on the property value is cleaner. Alternatively using an explicit setter method if the act of setting is significant. But these are more subjective design opinions rather than anything concrete. 😄 |
Fixed in #169 |
The following gives a NS1004 warning, even though the test works as expected:
gives the following warning:
with the following project:
This is probably related to #159, but with a different method, so I though I'd report it anyway.
The text was updated successfully, but these errors were encountered: