Ejemplo n.º 1
0
        public void Put_Candidate_OK(int id, string testname)
        {
            var _controller = new CandidatesController(new DummyRepositoryFacade());

            _controller.Request       = new HttpRequestMessage();
            _controller.Configuration = new HttpConfiguration();

            var getResult     = _controller.Get(id);
            var jsonGetResult = getResult as JsonResult <CandidateDTO>;
            var candidateDto  = jsonGetResult.Content;

            candidateDto.FirstName = testname;

            var putResult         = _controller.Put(id, candidateDto);
            var jsonPutResult     = getResult as JsonResult <CandidateDTO>;
            var candidateAfterPut = jsonPutResult.Content;

            Assert.AreEqual(testname, candidateAfterPut.FirstName);
        }