Esempio n. 1
0
        public void GetById_Returns_MetaData_When_Id_Is_Valid()
        {
            A.CallTo(() => _service.GetById(A <int> ._)).Returns(_singleResponse);

            var result   = _controller.GetById(0);
            var okresult = result.Result as OkObjectResult;

            var response = ((Response)okresult.Value);

            Assert.NotNull(response.Data);
            Assert.IsType <MetaData>(response.Data);
        }
Esempio n. 2
0
        public ActionResult <Response> GetById(int id)
        {
            var meta = _service.GetById(id);

            if (meta == null)
            {
                return(InternalServerError());
            }
            if (meta.Data == null)
            {
                return(NotFound());
            }

            return(Ok(meta));
        }