public void Property_ContentNegotiator_DirectDependency()
        {
            UpdatedODataResult<TestEntity> result = new UpdatedODataResult<TestEntity>(
                _entity, _contentNegotiator, _request, _formatters);

            Assert.Same(_contentNegotiator, result.ContentNegotiator);
        }
Пример #2
0
        private IHttpActionResult CreateActionResult(HttpRequestMessage request)
        {
            UpdatedODataResult <TestEntity> updatedODataResult = new UpdatedODataResult <TestEntity>(_entity,
                                                                                                     _contentNegotiator, request, _formatters);

            return(updatedODataResult.GetInnerActionResult());
        }
Пример #3
0
        public void Property_ContentNegotiator_Formatters()
        {
            UpdatedODataResult <TestEntity> result = new UpdatedODataResult <TestEntity>(
                _entity, _contentNegotiator, _request, _formatters);

            Assert.Same(_formatters, result.Formatters);
        }
Пример #4
0
        public void Property_ContentNegotiator_DirectDependency()
        {
            UpdatedODataResult <TestEntity> result = new UpdatedODataResult <TestEntity>(
                _entity, _contentNegotiator, _request, _formatters);

            Assert.Same(_contentNegotiator, result.ContentNegotiator);
        }
Пример #5
0
        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);
        }
Пример #10
0
 public TestUpdatedObjectResult(UpdatedODataResult <T> innerResult)
     : base(innerResult)
 {
 }
Пример #11
0
        private IActionResult CreateActionResult(AspNetCore.Http.HttpRequest request)
        {
            UpdatedODataResult <TestEntity> updatedODataResult = new UpdatedODataResult <TestEntity>(_entity);

            return(updatedODataResult.GetInnerActionResult(request));
        }