* Add NoContent Factory to Controller
This commit is contained in:
parent
ed46885586
commit
b8d58133c3
|
|
@ -508,6 +508,17 @@ namespace Microsoft.AspNet.Mvc
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a <see cref="NoContentResult"/> object that produces an empty No Content (204) response.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The created <see cref="NoContentResult"/> object for the response.</returns>
|
||||||
|
[NonAction]
|
||||||
|
public virtual NoContentResult NoContent()
|
||||||
|
{
|
||||||
|
return new NoContentResult();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="JsonResult"/> object that serializes the specified <paramref name="data"/> object
|
/// Creates a <see cref="JsonResult"/> object that serializes the specified <paramref name="data"/> object
|
||||||
/// to JSON.
|
/// to JSON.
|
||||||
|
|
|
||||||
|
|
@ -1055,6 +1055,19 @@ namespace Microsoft.AspNet.Mvc.Test
|
||||||
Assert.Same(model, actualViewResult.ViewData.Model);
|
Assert.Same(model, actualViewResult.ViewData.Model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Controller_NoContent()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var controller = new TestableController();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = controller.NoContent();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Equal(StatusCodes.Status204NoContent, result.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Controller_Content_WithParameterContentString_SetsResultContent()
|
public void Controller_Content_WithParameterContentString_SetsResultContent()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue