示例#1
0
        public async void ValidPersonel_ReturnsNotFound()
        {
            var controller = new GenericSystemsController(_genericSystemService, _personnelService);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = HttpContexts.Valid_Search;

            var response = await controller.GetPersonnel("5a8417f68317338c8e080a63");

            Assert.IsType <NotFoundObjectResult>(response);

            var notFoundResult = response as NotFoundObjectResult;

            Assert.Equal(404, notFoundResult.StatusCode);
        }
示例#2
0
        public async void ValidPersonel_ReturnsOk()
        {
            var controller = new GenericSystemsController(_genericSystemService, _personnelService);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = HttpContexts.Valid_Search;

            var response = await controller.GetPersonnel("5a8417f68317338c8e080a62");

            Assert.IsType <OkObjectResult>(response);

            var okResult = response as OkObjectResult;

            Assert.Equal(200, okResult.StatusCode);

            var responseContent = okResult.Value;

            Assert.IsType <PersonnelViewModel>(responseContent);
            var viewModel = responseContent as PersonnelViewModel;

            Assert.Equal("999 Call Handler", viewModel.Name);
            Assert.Equal("CModule-Type", viewModel.CModule);
        }