Beispiel #1
0
    public void MyMethod_WhenCalled_PartialViewIsReturned()
    {
        // Arrange
        // The magic I need to happen.
        var controller = new TestableHomeController {
            UseFakeAttributes = true
        };
        // Act
        var result = controller.MyMethod() as PartialViewResult;
        // Assert
        var model = result.Model;

        Assert.AreEqual("MyFakeTitle1.0.0.0", model);                 // currently static, need to verify against a mock
    }
    public void MyMethod_WhenCalled_PartialViewIsReturned()
    {
        // Arrange
        // The magic I need to happen.
        Mock <IDependency> dependencyStub = new Mock <IDependency>();
        // dependencyStub.Setup(...).Returns(...);
        var controller = new TestableHomeController(dependencyStub.Object)
        {
            UseFakeAttributes = true
        };
        // Act
        var result = controller.MyMethod() as PartialViewResult;
        // Assert
        var model = result.Model;

        Assert.AreEqual("MyFakeTitle1.0.0.0", model);                 // currently static, need to verify against a mock
    }