Ejemplo n.º 1
0
        public async Task <int> GetSuppliersCountFromIDM()
        {
            SupplierIntegrationSearchCriteria criteria = new SupplierIntegrationSearchCriteria
            {
                IsCountOnly = true
            };
            var suppliers = await _iidmService.GetSupplierDetailsBySearchCriteria(criteria);

            return(suppliers.TotalCount);
        }
Ejemplo n.º 2
0
        public async Task ShouldGetSuppliersBySearchCriteria()
        {
            //Arrange
            SupplierIntegrationSearchCriteria criteria = new SupplierIntegrationSearchCriteria {
            };
            //Act
            var result = await _IDMProxy.GetSuppliersBySearchCriteria(criteria);

            //Assert
            Assert.NotNull(result);
        }
Ejemplo n.º 3
0
        public async Task <QueryResult <SupplierIntegrationModel> > GetAllIDMSuppliers(SupplierSearchCretriaModel supplierSearchCretriaModel)
        {
            SupplierIntegrationSearchCriteria supplierIntegrationSearchCriteria = new SupplierIntegrationSearchCriteria
            {
                CrNumber     = supplierSearchCretriaModel.CommericalRegisterNo,
                SupplierName = supplierSearchCretriaModel.CommericalRegisterName,
                PageNumber   = supplierSearchCretriaModel.PageNumber
            };
            QueryResult <SupplierIntegrationModel> result = await _blockService.GetAllSuppliers(supplierIntegrationSearchCriteria);

            return(result);
        }
Ejemplo n.º 4
0
        public async Task <QueryResult <SolidarityInvitedRegisteredSupplierModel> > GetAllSuppliersBySearchCretriaForSolidarity(SolidaritySearchCriteria cretria)
        {
            SupplierIntegrationSearchCriteria      integrationSearchCriteria = _mapper.Map <SupplierIntegrationSearchCriteria>(cretria);
            QueryResult <SupplierIntegrationModel> suppliers = await _iidmService.GetSupplierDetailsBySearchCriteria(integrationSearchCriteria);

            List <SolidarityInvitedRegisteredSupplierModel> suppliersInvitation = suppliers.Items.Where(d => d.supplierNumber != cretria.CurrentSupplierCR).Select(supplier => new SolidarityInvitedRegisteredSupplierModel()
            {
                CrName   = supplier.supplierName,
                CrNumber = supplier.supplierNumber,
            }).ToList();
            QueryResult <SolidarityInvitedRegisteredSupplierModel> suppliersList = suppliersInvitation != null ? new QueryResult <SolidarityInvitedRegisteredSupplierModel>(suppliersInvitation, suppliers.TotalCount, suppliers.PageNumber, suppliers.PageSize) : new QueryResult <SolidarityInvitedRegisteredSupplierModel>(new List <SolidarityInvitedRegisteredSupplierModel>(), 0, 1, 1);

            return(suppliersList);
        }
Ejemplo n.º 5
0
        public async Task ShouldGetAllSuppliers()
        {
            //Mock
            _moqIDMApp.Setup(x => x.GetSupplierDetailsBySearchCriteria(It.IsAny <SupplierIntegrationSearchCriteria>()))
            .Returns(() =>
            {
                return(Task.FromResult(new QueryResult <SupplierIntegrationModel>(new List <SupplierIntegrationModel> {
                    new SupplierIntegrationModel()
                }, 1, 1, 1)));
            });

            //=== arrange=========
            var _blockObj = new SupplierIntegrationSearchCriteria();

            //============Return Result===========
            var result = await _sut.GetAllSuppliers(_blockObj);


            //====== Assert=====
            Assert.NotNull(result);
            Assert.IsType <QueryResult <SupplierIntegrationModel> >(result);
        }
Ejemplo n.º 6
0
        public async Task Should_GetAllSuppliersBySearchCretriaForSolidarity()
        {
            SolidaritySearchCriteria solidaritySearchCriteria = new SolidaritySearchCriteria();

            solidaritySearchCriteria.CurrentSupplierCR = "1299659801";
            SupplierIntegrationSearchCriteria integrationSearchCriteria = new SupplierIntegrationSearchCriteria()
            {
                CrNumber = "1299659801"
            };

            _moqMapper.Setup(m => m.Map <SupplierIntegrationSearchCriteria>(It.IsAny <SolidaritySearchCriteria>()))
            .Returns(() => { return(integrationSearchCriteria); });
            _moqIidmService.Setup(s => s.GetSupplierDetailsBySearchCriteria(It.IsAny <SupplierIntegrationSearchCriteria>()))
            .Returns(() =>
            {
                return(Task.FromResult <QueryResult <SupplierIntegrationModel> >(new IDMDefaults().GetSupplierIntegrationModelQueryResult()));
            });

            var result = await _sut.GetAllSuppliersBySearchCretriaForSolidarity(solidaritySearchCriteria);

            Assert.NotNull(result);
        }
Ejemplo n.º 7
0
        public async Task <QueryResult <SupplierIntegrationModel> > GetAllSuppliers(SupplierIntegrationSearchCriteria searchCriteria)
        {
            var supplierList = await _iDMAppService.GetSupplierDetailsBySearchCriteria(searchCriteria);

            return(supplierList);
        }