public void Property_ContentNegotiator_DirectDependency() { UpdatedODataResult<TestEntity> result = new UpdatedODataResult<TestEntity>( _entity, _contentNegotiator, _request, _formatters); Assert.Same(_contentNegotiator, result.ContentNegotiator); }
private IHttpActionResult CreateActionResult(HttpRequestMessage request) { UpdatedODataResult <TestEntity> updatedODataResult = new UpdatedODataResult <TestEntity>(_entity, _contentNegotiator, request, _formatters); return(updatedODataResult.GetInnerActionResult()); }
public void Property_ContentNegotiator_Formatters() { UpdatedODataResult <TestEntity> result = new UpdatedODataResult <TestEntity>( _entity, _contentNegotiator, _request, _formatters); Assert.Same(_formatters, result.Formatters); }
public void Property_ContentNegotiator_DirectDependency() { UpdatedODataResult <TestEntity> result = new UpdatedODataResult <TestEntity>( _entity, _contentNegotiator, _request, _formatters); Assert.Same(_contentNegotiator, result.ContentNegotiator); }
public void GetEntity_ReturnsCorrect() { // Arrange Mock <UpdatedODataResultTest> mock = new Mock <UpdatedODataResultTest>(); UpdatedODataResult <UpdatedODataResultTest> updatedODataResult = new UpdatedODataResult <UpdatedODataResultTest>(mock.Object); // Act & Assert Assert.Same(mock.Object, updatedODataResult.Entity); }
public void Property_ContentNegotiator_Formatters() { UpdatedODataResult<TestEntity> result = new UpdatedODataResult<TestEntity>( _entity, _contentNegotiator, _request, _formatters); Assert.Same(_formatters, result.Formatters); }
public void GetActionResult_ReturnsNegotiatedContentResult_IfRequestAsksForContent() { // Arrange HttpRequestMessage request = new HttpRequestMessage(); request.Headers.TryAddWithoutValidation("Prefer", "return-content"); UpdatedODataResult<TestEntity> updatedODataResult = new UpdatedODataResult<TestEntity>(_entity, _contentNegotiator, request, _formatters); // Act IHttpActionResult result = updatedODataResult.GetInnerActionResult(); // Assert NegotiatedContentResult<TestEntity> negotiatedResult = Assert.IsType<NegotiatedContentResult<TestEntity>>(result); Assert.Equal(HttpStatusCode.OK, negotiatedResult.StatusCode); Assert.Same(request, negotiatedResult.Request); Assert.Same(_contentNegotiator, negotiatedResult.ContentNegotiator); Assert.Same(_entity, negotiatedResult.Content); Assert.Same(_formatters, negotiatedResult.Formatters); }
public void GetActionResult_ReturnsNoContentStatusCodeResult_IfRequestHasNoPreferenceHeader() { // Arrange UpdatedODataResult<TestEntity> updatedODataResult = new UpdatedODataResult<TestEntity>( _entity, _contentNegotiator, _request, _formatters); // Act IHttpActionResult result = updatedODataResult.GetInnerActionResult(); // Assert StatusCodeResult statusCodeResult = Assert.IsType<StatusCodeResult>(result); Assert.Equal(HttpStatusCode.NoContent, statusCodeResult.StatusCode); Assert.Same(_request, statusCodeResult.Request); }
public void GetActionResult_ReturnsNoContentStatusCodeResult_IfRequestAsksForNoContent() { // Arrange HttpRequestMessage request = new HttpRequestMessage(); request.Headers.TryAddWithoutValidation("Prefer", "return=minimal"); UpdatedODataResult<TestEntity> updatedODataResult = new UpdatedODataResult<TestEntity>(_entity, _contentNegotiator, request, _formatters); // Act IHttpActionResult result = updatedODataResult.GetInnerActionResult(); // Assert StatusCodeResult statusCodeResult = Assert.IsType<StatusCodeResult>(result); Assert.Equal(HttpStatusCode.NoContent, statusCodeResult.StatusCode); Assert.Same(request, statusCodeResult.Request); }
public TestUpdatedObjectResult(UpdatedODataResult <T> innerResult) : base(innerResult) { }
private IActionResult CreateActionResult(AspNetCore.Http.HttpRequest request) { UpdatedODataResult <TestEntity> updatedODataResult = new UpdatedODataResult <TestEntity>(_entity); return(updatedODataResult.GetInnerActionResult(request)); }