How to use Nsubstitute analyser.

140 views
Skip to first unread message

Vatan Soni

unread,
Mar 20, 2019, 7:53:41 AM3/20/19
to NSubstitute
1. Does it give any UI. 
2. How i make sure that its working and how to use it.

David Tchepak

unread,
Mar 20, 2019, 8:11:48 AM3/20/19
to nsubs...@googlegroups.com
Hi Vatan,

There is no UI. If you add the package to your test project (either the C# or VB package according to the test project language), then your project will start giving compiler warnings or errors if the analyzers find any problems. You can test it is working by breaking one of the rules, such as attempting to stub a non-virtual member:

public class Sample {
    public int Example() { return 42; }
}

[Test]
public void AreAnalyzersWorking() {
  var sub = Substitute.For<Sample>();
  sub.Example().Returns(100); // <-- should give compiler error about non-virtual method
}

Let me know if you have any trouble with it.

Regards,
David

On Wed, Mar 20, 2019 at 10:53 PM Vatan Soni <vatan...@gmail.com> wrote:
1. Does it give any UI. 
2. How i make sure that its working and how to use it.

--
You received this message because you are subscribed to the Google Groups "NSubstitute" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nsubstitute...@googlegroups.com.
To post to this group, send email to nsubs...@googlegroups.com.
Visit this group at https://groups.google.com/group/nsubstitute.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages