Пример #1
0
        public void Contest_Get_ShouldBeOk()
        {
            //Cenário
            _contest = ObjectMother.ValidContestWithId();
            _mockContestRepository.Setup(rp => rp.Get(_contest.Id)).Returns(_contest);

            //Ação
            Contest getContest = _contestService.Get(_contest);

            //Verificar
            getContest.Should().Be(_contest);
            _mockContestRepository.Verify(rp => rp.Get(_contest.Id));
        }
Пример #2
0
        // GET api/Contests/5
        public HttpResponseMessage Get(int id)
        {
            if (ContestService.Exists(id))
            {
                return(Request.CreateResponse(HttpStatusCode.OK, ContestService.Get(id).ConvertToDto()));
            }

            return(Request.CreateResponse(HttpStatusCode.NotFound));
        }