MS 测试相当于 Nunits Substitue.For

MS Test equivalent to Nunits Substitue.For

我在 Nunit 单元测试中看到了下面的代码

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

使用 MS 测试的等效代码是什么?

该代码片段用于NSubstitute 模拟框架,与NUnit 单元测试框架无关。

MS Test 也是一个测试框架,显示的代码对于 Nunit 或 MS Test 运行相同。

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

        //...
    }    
}