コード例 #1
0
        public async Task ShouldUpdateFreeTenderPurchaseDetailsSucess()
        {
            BillModel billModel = new BillDefaults().GetBillModelData();
            BillInfo  billInfo  = new BillDefaults().GetBillInfoData();

            _idmAppServiceMock.Setup(x => x.GetSupplierInfoByCR(It.IsAny <string>()))
            .Returns(() =>
            {
                return(Task.FromResult <SupplierFullDataModel>(new BillDefaults().GetSupplierFullData()));
            });

            _idmAppServiceMock.Setup(x => x.GetAgencyDetailsRelatedToSadad(It.IsAny <string>(), It.IsAny <int>()))
            .Returns(() =>
            {
                return(Task.FromResult <AgencyInfoModel>(new BillDefaults().GetAgencyInfoModelData()));
            });

            _billProxyMock.Setup(x => x.CreateNewBill(It.IsAny <NewBillModel>()))
            .Returns(() =>
            {
                return(Task.FromResult <string>(new BillDefaults()._billInvoicenumber));
            });
            billModel.AmountDue = 0;
            var result = await _billAppService.StoreBillsAndUploadToSadad(billModel, billInfo, new BillDefaults()._cr, new BillDefaults()._agencyType, true);

            Assert.IsType <bool>(result);
        }
コード例 #2
0
        public async Task ShouldSetBillPaidForInvitationSucess()
        {
            PaymentNotificationServiceModel postedModel = new BillDefaults().GetPaymentNotificationServiceData();
            BillInfo billInfo = new BillDefaults().GetBillInfoDataForInvitation();

            billInfo.Invitation.Test_AddTender(new TenderDefault().GetGeneralTender());

            _billQueriesMock.Setup(x => x.FindBulkBillByInvoiceNumberWithTenderInfoAsync(It.IsAny <string>()))
            .Returns(() =>
            {
                return(Task.FromResult <BillInfo>(billInfo));
            });

            _billQueriesMock.Setup(x => x.FindBillByInvoiceNumberWithTender(It.IsAny <string>()))
            .Returns(() =>
            {
                return(Task.FromResult <BillInfo>(new BillDefaults().GetBillInfoDataForInvitation()));
            });


            var result = await _billAppService.SetBillPaid(postedModel);

            Assert.IsType <string>(result);
            Assert.NotNull(result);
        }
コード例 #3
0
        public async Task ShouldCreateBillInvoiceNumberSucess(int requestType, int tenderFees)
        {
            List <TenderFinantialCostModel> TenderFees = new List <TenderFinantialCostModel>();


            BillModel billModel = new BillDefaults().GetBillModelData();
            BillInfo  billInfo  = new BillDefaults().GetBillInfoData();

            _idmAppServiceMock.Setup(x => x.GetSupplierInfoByCR(It.IsAny <string>()))
            .Returns(() =>
            {
                return(Task.FromResult <SupplierFullDataModel>(new BillDefaults().GetSupplierFullData()));
            });

            _idmAppServiceMock.Setup(x => x.GetAgencyDetailsRelatedToSadad(It.IsAny <string>(), It.IsAny <int>()))
            .Returns(() =>
            {
                return(Task.FromResult <AgencyInfoModel>(new BillDefaults().GetAgencyInfoModelData()));
            });

            _billProxyMock.Setup(x => x.CreateNewBill(It.IsAny <NewBillModel>()))
            .Returns(() =>
            {
                return(Task.FromResult <string>(new BillDefaults()._billInvoicenumber));
            });
            billModel.RequestType = requestType;
            TenderFees.Add(new TenderFinantialCostModel()
            {
                FessType = tenderFees
            });
            var result = await _billAppService.StoreBillsAndUploadToSadad(billModel, billInfo, new BillDefaults()._cr, new BillDefaults()._agencyType, true);

            Assert.IsType <bool>(result);
        }
コード例 #4
0
        public async Task ShouldThowBussinessExceptionWhenBillIsNull()
        {
            PaymentNotificationServiceModel postedModel = new BillDefaults().GetPaymentNotificationServiceData();

            _billQueriesMock.Setup(x => x.FindBulkBillByInvoiceNumberWithTenderInfoAsync(It.IsAny <string>()))
            .Returns(() =>
            {
                return(Task.FromResult <BillInfo>(new BillInfo()));
            });
            await Assert.ThrowsAsync <NullReferenceException>(async() => await _billAppService.SetBillPaid(postedModel));
        }
コード例 #5
0
        public async Task ShouldCreateBillArchiveWithoutSaveSuccess()
        {
            _moqBillArchiveCommand.Setup(x => x.CreateWithoutSave(It.IsAny <BillArchive>()))
            .Returns((BillArchive obj) =>
            {
                return(Task.FromResult(obj));
            });

            BillArchive billArchive = new BillDefaults().GetBillArchiveData();
            var         result      = await _moqBillArchiveCommand.Object.CreateWithoutSave(billArchive);

            Assert.NotNull(result);
            Assert.IsType <BillArchive>(result);
        }
コード例 #6
0
        public async Task ShouldDeleteWithoutSaveSuccess()
        {
            _moqBillCommand.Setup(x => x.DeleteWithoutSave(It.IsAny <BillInfo>()))
            .Returns((BillInfo obj) =>
            {
                return(Task.FromResult(obj));
            });

            BillInfo billInfo = new BillDefaults().GetBillInfoData();
            var      result   = await _moqBillCommand.Object.DeleteWithoutSave(billInfo);

            Assert.NotNull(result);
            Assert.IsType <BillInfo>(result);
        }
コード例 #7
0
        public async Task ShouldThowBussinessExceptionWhenBillInvoicNnumberIsNull(int requestType)
        {
            BillModel billModel = new BillDefaults().GetBillModelData();
            BillInfo  billInfo  = new BillDefaults().GetBillInfoData();

            _idmAppServiceMock.Setup(x => x.GetSupplierInfoByCR(It.IsAny <string>()))
            .Returns(() =>
            {
                return(Task.FromResult <SupplierFullDataModel>(new BillDefaults().GetSupplierFullData()));
            });

            _idmAppServiceMock.Setup(x => x.GetAgencyDetailsRelatedToSadad(It.IsAny <string>(), It.IsAny <int>()))
            .Returns(() =>
            {
                return(Task.FromResult <AgencyInfoModel>(new BillDefaults().GetAgencyInfoModelData()));
            });
            billModel.RequestType = requestType;
            await Assert.ThrowsAsync <BusinessRuleException>(async() => await _billAppService.StoreBillsAndUploadToSadad(billModel, billInfo, new BillDefaults()._cr, new BillDefaults()._agencyType, true));
        }