Exemplo n.º 1
0
        public IHttpActionResult UpdateIntakeOrigin(OrdersTransfereeIntakeOriginDto dto)
        {
            var   userId = User.Identity.GetUserId();
            Order order  = _unitOfWork.Orders.GetOrderFor(userId, dto.Id, User.GetUserRole());

            if (order == null)
            {
                return(NotFound());
            }

            _mapper.Map <OrdersTransfereeIntakeOriginDto, Order>(dto, order);
            _unitOfWork.Complete();

            return(Ok());
        }
        public void UpdateIntakeOrigin_NoOrder_ReturnNotFound()
        {
            var   orderId = "1";
            Order order   = null;

            _mockRepository.Setup(r => r.GetOrderFor(_userId, orderId, UserRoles.Consultant)).Returns(order);

            var dto = new OrdersTransfereeIntakeOriginDto()
            {
                Id = orderId, OriginCountry = "Canada", OriginCity = "Toronto", OriginState = "Alberta"
            };

            var result = _controller.UpdateIntakeOrigin(dto) as IHttpActionResult;

            result.Should().BeOfType <System.Web.Http.Results.NotFoundResult>();
        }