Exemplo n.º 1
0
        public async void HRBorderControllerOnGetByIDWithNullServiceExpectStatus500InternalServerError()
        {
            HRBordersController    ctrl          = new HRBordersController(null, null);
            Task <(int, HRBorder)> resultService = ctrl.GetFromID("XX");
            await resultService;

            Assert.True(resultService.Result.Item1 == StatusCodes.Status500InternalServerError);
            Assert.True(resultService.Result.Item2 == null);
        }
Exemplo n.º 2
0
        public async void HRBorderControllerOnGetByIDNullExpectStatus400BadRequest()
        {
            List <String>          list          = new List <String>();
            HRBordersController    ctrl          = new HRBordersController(null, new CoreBordersServiceStub(list));
            Task <(int, HRBorder)> resultService = ctrl.GetFromID(null);
            await resultService;

            Assert.True(resultService.Result.Item1 == StatusCodes.Status400BadRequest);
            Assert.True(resultService.Result.Item2 == null);
        }
Exemplo n.º 3
0
        public async void HRBorderControllerOnGetByIDWithExistingItemExpectItemAndCodeStatus200()
        {
            List <String> list = new List <String>()
            {
                ("XX"), ("YY")
            };
            CoreBordersServiceStub service       = new CoreBordersServiceStub(list);
            HRBordersController    ctrl          = new HRBordersController(null, service);
            Task <(int, HRBorder)> resultService = ctrl.GetFromID("XX");
            await resultService;

            Assert.True(resultService.Result.Item1 == StatusCodes.Status200OK);
            Assert.True(resultService.Result.Item2 != null && resultService.Result.Item2.FIPS == "XX");
        }
Exemplo n.º 4
0
        public async void HRBorderControllerOnGetByIDWithExceptionThrownByServiceExpectStatus500InternalServerError()
        {
            List <String> list = new List <String>()
            {
                ("XX")
            };
            CoreBordersServiceStub service = new CoreBordersServiceStub(list)
            {
                ThrowException = true
            };
            HRBordersController    ctrl          = new HRBordersController(null, service);
            Task <(int, HRBorder)> resultService = ctrl.GetFromID("XX");
            await resultService;

            Assert.True(resultService.Result.Item1 == StatusCodes.Status500InternalServerError);
            Assert.True(resultService.Result.Item2 == null);
        }