public async Task TestCandidateControllerResponse()
        {
            int    jobId = 1;
            int    numberCandidatesToReturn = 1;
            string relevance      = "quantity";
            int    resultExpected = 1;


            var okResult = await _controller.Get(jobId, numberCandidatesToReturn, relevance);

            var listOfMostQualifiedCandidates = ((ObjectResult)((ActionResult <List <CandidateViewModel> >)(okResult)).Result).Value as List <CandidateViewModel>;

            Assert.AreEqual(resultExpected, listOfMostQualifiedCandidates.Count);
        }
예제 #2
0
        public async void Get_Candidate_BadId(int id)
        {
            var _controller = new CandidatesController(new DummyRepositoryFacade());

            _controller.Request       = new System.Net.Http.HttpRequestMessage();
            _controller.Configuration = new System.Web.Http.HttpConfiguration();

            var result   = _controller.Get(id);
            var response = await result.ExecuteAsync(new System.Threading.CancellationToken());

            Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode);
        }
예제 #3
0
        public void Get_Candidate(int id)
        {
            var _controller = new CandidatesController(new DummyRepositoryFacade());

            _controller.Request       = new System.Net.Http.HttpRequestMessage();
            _controller.Configuration = new System.Web.Http.HttpConfiguration();

            var jsonResult = _controller.Get(id);
            var result     = jsonResult as JsonResult <CandidateDTO>;

            Assert.AreEqual("TESTNAME", result.Content.FirstName);
            Assert.AreEqual(id, result.Content.Id);
        }
예제 #4
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);
        }