public async Task Should_Success_Create_Data()
        {
            TransferOutFacade    facade = new TransferOutFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            ReturnToCenterFacade returnToCenterFacade = new ReturnToCenterFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var model = await dataUtil(facade, GetCurrentMethod()).GetNewData();

            var viewmodel = dataUtil(facade, GetCurrentMethod()).MapToViewModel(model);
            var Response  = await returnToCenterFacade.Create(viewmodel, model, USERNAME);

            Assert.NotEqual(0, Response);
        }
        public async Task Should_Success_Get_Excel_By_Id()
        {
            TransferOutFacade    facade = new TransferOutFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            ReturnToCenterFacade returnToCenterFacade = new ReturnToCenterFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var model = await dataUtil(facade, GetCurrentMethod()).GetNewData();

            var viewmodel = dataUtil(facade, GetCurrentMethod()).MapToViewModel(model);
            await returnToCenterFacade.Create(viewmodel, model, USERNAME);

            var Response = returnToCenterFacade.GenerateExcel((int)model.Id);

            Assert.IsType <MemoryStream>(Response);
        }
        public async Task <IActionResult> Post([FromBody] TransferOutDocViewModel ViewModel)
        {
            try
            {
                identityService.Username = User.Claims.Single(p => p.Type.Equals("username")).Value;

                IValidateService validateService = (IValidateService)serviceProvider.GetService(typeof(IValidateService));

                validateService.Validate(ViewModel);

                var model = mapper.Map <TransferOutDoc>(ViewModel);

                await facade.Create(ViewModel, model, identityService.Username);

                // await facade.Crea

                Dictionary <string, object> Result =
                    new ResultFormatter(ApiVersion, General.CREATED_STATUS_CODE, General.OK_MESSAGE)
                    .Ok();
                return(Created(String.Concat(Request.Path, "/", 0), Result));
            }
            catch (ServiceValidationExeption e)
            {
                Dictionary <string, object> Result =
                    new ResultFormatter(ApiVersion, General.BAD_REQUEST_STATUS_CODE, General.BAD_REQUEST_MESSAGE)
                    .Fail(e);
                return(BadRequest(Result));
            }
            catch (Exception e)
            {
                Dictionary <string, object> Result =
                    new ResultFormatter(ApiVersion, General.INTERNAL_ERROR_STATUS_CODE, e.Message)
                    .Fail();
                return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE, Result));
            }
        }