示例#1
0
        public HttpResponseMessage Get(int id)
        {
            var agentAPIResult = new AgentAPIResult()
            {
                Usage = "HttpGet:~/api/Agent/{id} or {args} can be on querystring, {args?} are optional"
            };

            agentAPIResult.Agent = AgentBusinessLayer.GetAgent(id);

            if (agentAPIResult.Agent == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, agentAPIResult));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, agentAPIResult));
        }
示例#2
0
 public void WillCallDBLayerOnceWhenGetById()
 {
     AgentBusinessLayer.GetAgent(1);
     mockDBLayer.Verify(m => m.FindEntity <Agent>(It.IsAny <int>()), Times.Once);
 }