public void GetHttpActionResultForDelete_NotFound_ShouldReturnNotFoundResult()
        {
            var result         = ErrorResultExtensions.ToNotFound();
            var actionResult   = WebApiControllerHelper.GetHttpActionResultForDelete(result, Substitute.For <ApiController>());
            var notFoundResult = actionResult as NotFoundResult;

            notFoundResult.ShouldNotBeNull();
        }
Пример #2
0
        public IResult <Error> Handle(Command message)
        {
            var id = message.Id;

            var exists = _repository.ExistsById(id);

            if (!exists)
            {
                return(ErrorResultExtensions.ToNotFound());
            }

            _repository.Update(message);

            return(Result <Error> .Ok());
        }
Пример #3
0
        public IResult <Product, Error> Handle(Query message)
        {
            var product = _repository.GetProductById(message.Id);

            return(product.HasNoValue ? ErrorResultExtensions.ToNotFound <Product>() : Result <Product, Error> .Ok(product.Value));
        }