/// <summary>
        /// Calls service to get all the employers for logged in user
        /// </summary>
        /// <returns></returns>
        public IActionResult Employer()
        {
            var model = new List <Employer>();

            model = employerService.GetAllEmployers();
            return(View(model));
        }
示例#2
0
        public ActionResult <List <Employer> > GetAllEmployers()
        {
            var employers = employerService.GetAllEmployers();

            if (employers.Count == 0)
            {
                return(NotFound());
            }

            return(Ok(employers));
        }
        public void WhenCalled_GetAllEmployers_ReturnsEmptyEmployerList()
        {
            //Arrange


            var httpClient = CreateHttpClient(HttpStatusCode.Unauthorized, new List <Employer>());

            employerService = new EmployerService(httpClient);

            // ACT

            var actualResult = employerService.GetAllEmployers();

            //Assert

            Assert.AreEqual(0, actualResult.Count);
        }
        public void WhenCalled_GetAllEmployers_ReturnsValidListOfEmployers()
        {
            //Arrange
            var employers = new List <Employer>
            {
                new Employer
                {
                    EmployerName = "Test"
                }
            };

            var httpClient = CreateHttpClient(HttpStatusCode.OK, employers);

            employerService = new EmployerService(httpClient);

            // ACT

            var actualResult = employerService.GetAllEmployers();

            //Assert

            Assert.AreEqual(1, actualResult.Count);
        }