public async Task ShouldReturnExceptionIfSRMFrameworkAgreementManageModelIsNullAsync()
        {
            //Arrange
            SRMFrameworkAgreementManageFunctionIDConfiguration fun = new SRMFrameworkAgreementManageFunctionIDConfiguration()
            {
                SRMFrameworkAgreementMngFunctionID = "15060000"
            };
            SRMFrameworkAgreementManageServiceIDConfiguration serv = new SRMFrameworkAgreementManageServiceIDConfiguration()
            {
                SRMFrameworkAgreementMngServiceID = "SRMFrameworkAgreementMng"
            };
            EsbSettingsConfiguration esbSettingsConfiguration = new EsbSettingsConfiguration()
            {
                IsProduction = false, ClientCertificateFindValue = "EtimadIDMProd"
            };
            ServicesConfiguration servicesConfiguration = new ServicesConfiguration()
            {
                SRMFrameworkAgreementManageService = "https://10.14.8.25:7923/SRMFrameworkAgreementManage11"
            };
            IsSRMFrameworkAgreementWorkConfiguration obj = new IsSRMFrameworkAgreementWorkConfiguration()
            {
                isSRMFrameworkAgreementWork = true
            };

            var options = new RootConfigurations()
            {
                SRMFrameworkAgreementManageFunctionIDConfiguration = fun,
                SRMFrameworkAgreementManageServiceIDConfiguration  = serv,
                EsbSettingsConfiguration = esbSettingsConfiguration,
                ServicesConfiguration    = servicesConfiguration,
                isSRMFrameworkAgreementWorkConfiguration = obj
            };
            var mock = new Mock <IOptionsSnapshot <RootConfigurations> >();

            mock.Setup(m => m.Value).Returns(options);
            _SRMFrameworkAgreementManageProxy = new SRMFrameworkAgreementManageProxy(mock.Object);

            SRMFrameworkAgreementManageModel requestData = null;

            //Act
            var result = await _SRMFrameworkAgreementManageProxy.SRMFrameworkAgreementManage(requestData);

            //Assert
            Assert.False(result);
        }
Пример #2
0
        public async Task Should_SendFinalAwardedTendersToEmarketPlace_Return_True()
        {
            Tender tender = new TenderDefault().GetGeneralTender();

            tender.SetTenderReceivedOffers(new OfferDefaults().GetOfferList());

            List <Tender> tenders = new List <Tender>()
            {
                tender
            };

            _tenderJobQueires.Setup(x => x.GetAllFinalAwardedTendersForEmarketPlace()).Returns(() =>
            {
                return(Task.FromResult <List <Tender> >(tenders));
            });

            EmarketPlaceRequest emarketPlaceRequest = new EmarketPlaceRequest()
            {
                FormId = 1, TableId = 1
            };

            List <EmarketPlaceRequest> emarketPlaceRequests = new List <EmarketPlaceRequest>()
            {
                emarketPlaceRequest
            };

            _tenderJobQueires.Setup(x => x.GetAwardedSupplierQuantityTableItemsValue(It.IsAny <List <int> >())).Returns(() =>
            {
                return(Task.FromResult <List <EmarketPlaceRequest> >(emarketPlaceRequests));
            });

            EmarketPlaceResponse emarketPlaceResponse = new EmarketPlaceResponse()
            {
                FormId = 1, ColumnId = 1, ColumnTypeId = (int)Enums.ColumnValueEnum.Description
            };
            List <EmarketPlaceResponse> emarketPlaceResponses = new List <EmarketPlaceResponse>()
            {
                emarketPlaceResponse
            };
            ApiResponse <List <EmarketPlaceResponse> > apiResponse = new ApiResponse <List <EmarketPlaceResponse> >()
            {
                Data = emarketPlaceResponses
            };

            _templatesProxy.Setup(x => x.GetEmarketPlace(It.IsAny <List <EmarketPlaceRequest> >())).Returns(() =>
            {
                return(Task.FromResult <ApiResponse <List <EmarketPlaceResponse> > >(apiResponse));
            });

            SRMFrameworkAgreementManageModel sRMFramework = new SRMFrameworkAgreementManageModel();

            _tenderJobQueires.Setup(x => x.FillVendorProducts(It.IsAny <List <int> >(), It.IsAny <List <EmarketPlaceResponse> >())).Returns(() =>
            {
                return(Task.FromResult <SRMFrameworkAgreementManageModel>(sRMFramework));
            });

            _sRMFrameworkAgreementManageProxy.Setup(x => x.SRMFrameworkAgreementManage(It.IsAny <SRMFrameworkAgreementManageModel>())).Returns(() =>
            {
                return(Task.FromResult <bool>(true));
            });

            await _sut.SendFinalAwardedTendersToEmarketPlace();

            _genericCommandRepository.Verify(x => x.SaveAsync(), Times.Once);
        }
        public async Task ShouldReturnTrueFromSRMFrameworkAgreementManageService()
        {
            //Arrange
            SRMFrameworkAgreementManageFunctionIDConfiguration fun = new SRMFrameworkAgreementManageFunctionIDConfiguration()
            {
                SRMFrameworkAgreementMngFunctionID = "15060000"
            };
            SRMFrameworkAgreementManageServiceIDConfiguration serv = new SRMFrameworkAgreementManageServiceIDConfiguration()
            {
                SRMFrameworkAgreementMngServiceID = "SRMFrameworkAgreementMng"
            };
            EsbSettingsConfiguration esbSettingsConfiguration = new EsbSettingsConfiguration()
            {
                IsProduction = false, ClientCertificateFindValue = "EtimadIDMProd"
            };
            ServicesConfiguration servicesConfiguration = new ServicesConfiguration()
            {
                SRMFrameworkAgreementManageService = "https://10.14.8.25:7923/SRMFrameworkAgreementManage11"
            };
            IsSRMFrameworkAgreementWorkConfiguration obj = new IsSRMFrameworkAgreementWorkConfiguration()
            {
                isSRMFrameworkAgreementWork = true
            };
            var options = new RootConfigurations()
            {
                SRMFrameworkAgreementManageFunctionIDConfiguration = fun,
                SRMFrameworkAgreementManageServiceIDConfiguration  = serv,
                EsbSettingsConfiguration = esbSettingsConfiguration,
                ServicesConfiguration    = servicesConfiguration,
                isSRMFrameworkAgreementWorkConfiguration = obj
            };
            var mock = new Mock <IOptionsSnapshot <RootConfigurations> >();

            mock.Setup(m => m.Value).Returns(options);
            _SRMFrameworkAgreementManageProxy = new SRMFrameworkAgreementManageProxy(mock.Object);

            List <VendorList>  vendorLst    = new List <VendorList>();
            List <ProductList> productLists = new List <ProductList>();
            List <string>      agencyList   = new List <string>();
            var requestData = new SRMFrameworkAgreementManageModel();

            requestData.ReferenceNumber = "4000012345";
            requestData.ContractName    = " Framework for Stationary purchase";
            requestData.ContractType    = SRMContractType.Open;
            requestData.AwardDt         = DateTime.Now;
            requestData.CreatedBy       = "014014000000";
            requestData.ValidityInfo    = new ValidityInfo()
            {
                NumOfDays   = 15,
                NumOfMonths = 0,
                NumOfYears  = 1
            };
            requestData.ValidFrom = DateTime.Now;
            requestData.Currency  = "SAR";
            requestData.TotalAmt  = 1000;
            requestData.Note      = "note";

            var deliveryDurationInfo = new DeliveryDurationInfo()
            {
                NumOfDays = 1, NumOfMonths = 1, NumOfYears = 1
            };

            productLists.Add(new ProductList()
            {
                ProductId = "1", ProductName = "chair", UnitPrice = 1, Quantity = 1, UnitOfMeasure = "Each", VATAmt = 123, DiscountPercen = 5, DeliveryDurationInfo = deliveryDurationInfo, Desc = "desc"
            });

            vendorLst.Add(new VendorList()
            {
                VendorId         = "2050016410",
                AwardedAmt       = 60000,
                PurchaseCurrency = "SAR",
                ProductList      = productLists
            });

            agencyList.Add("041001000000");
            requestData.AgencyList  = agencyList;
            requestData.VendorsList = vendorLst;
            //Act
            var result = await _SRMFrameworkAgreementManageProxy.SRMFrameworkAgreementManage(requestData);

            //Assert
            Assert.True(result);
        }