public async Task Should_Fail_Delete_Empty_Id()
        {
            CashierApprovalService service = new CashierApprovalService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var deleteResponse             = await service.DeleteCashierAproval(-1);

            Assert.Equal(0, deleteResponse);
        }
        public async Task Should_Success_Delete_Approval_Non_PO()
        {
            CashierApprovalService service = new CashierApprovalService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            VbRequestModel         model   = await _dataUtil(service).GetTestData();

            CashierApprovalViewModel data = new CashierApprovalViewModel()
            {
                VBRequestCategory = "NONPO",
                CashierApproval   = new List <CashierApprovalItemViewModel>()
                {
                    new CashierApprovalItemViewModel()
                    {
                        VBNo = model.VBNo,
                        Id   = model.Id
                    }
                }
            };
            var acceptedResponse = await service.CashierAproval(data);

            var newModel = await service.ReadByIdAsync(model.Id);

            var deleteResponse = await service.DeleteCashierAproval(newModel.Id);

            Assert.NotEqual(0, deleteResponse);
        }
        public async Task Should_Fail_Delete_Approval_Non_PO()
        {
            var serviceProvider = new Mock <IServiceProvider>();

            serviceProvider
            .Setup(x => x.GetService(typeof(IHttpClientService)))
            .Returns(new HttpClientTestService());

            Mock <IIdentityService> mockIdentity = new Mock <IIdentityService>();

            mockIdentity
            .Setup(s => s.Username)
            .Throws(new Exception());

            serviceProvider
            .Setup(x => x.GetService(typeof(IIdentityService)))
            .Returns(mockIdentity.Object);

            CashierApprovalService service   = new CashierApprovalService(serviceProvider.Object, _dbContext(GetCurrentAsyncMethod()));
            VbRequestModel         vbRequest = new VbRequestModel()
            {
                VBNo              = "VBNo",
                Date              = DateTimeOffset.UtcNow,
                DateEstimate      = DateTimeOffset.UtcNow,
                UnitId            = 1,
                UnitCode          = "UnitCode",
                UnitName          = "UnitName",
                CurrencyId        = 1,
                CurrencyCode      = "CurrencyCode",
                CurrencyRate      = 123,
                CurrencySymbol    = "CurrencySymbol",
                Amount            = 123,
                Usage             = "Usage",
                UnitLoad          = "UnitLoad",
                Apporve_Status    = false,
                Complete_Status   = false,
                VBRequestCategory = "NONPO",
                CreatedBy         = "CreatedBy"
            };

            service.DbContext.VbRequests.Add(vbRequest);
            service.DbContext.SaveChanges();


            await Assert.ThrowsAnyAsync <Exception>(() => service.DeleteCashierAproval(1));
        }