Ctrl_Alt_Defeat
Ctrl_Alt_Defeat

Reputation: 4009

MS Test equivalent to Nunits Substitue.For

I have seen the following code in a Nunit unit test

        var controllerDescriptor = Substitute.For<HttpControllerDescriptor>();

What is the equivalent code using MS Test?

Upvotes: 2

Views: 689

Answers (1)

Nkosi
Nkosi

Reputation: 247631

The code snippet is for NSubstitute mocking framework and has nothing to do with NUnit unit testing framework.

MS Test is also a testing framework and the shown code runs the same for Nunit or MS Test.

[TestClass]
public class MytestClass {
    [TestMethod]
    public void MyTest() {
        var controllerDescriptor = Substitute.For<HttpControllerDescriptor>();

        //...
    }    
}

Upvotes: 4

Related Questions