public void HandleAjaxError() { // Arrange m_mockAbstractController.ViewData = new ViewDataDictionary(); m_mockAbstractController.ViewData.ModelState.AddModelError("key1", "my error"); // Act var result = m_mockAbstractController.HandleAjaxError2() as ContentResult; // Assert Assert.NotNull(result); Assert.Equal("my error", result.Content); }