public Mock <IServiceProvider> GetServiceProvider(IProductPackingService productPackingService, IIdentityProvider identityProvider, IValidateService validateService)
        {
            var spMock = new Mock <IServiceProvider>();

            spMock.Setup(s => s.GetService(typeof(IProductPackingService)))
            .Returns(productPackingService);

            spMock.Setup(s => s.GetService(typeof(IIdentityProvider)))
            .Returns(identityProvider);

            spMock.Setup(s => s.GetService(typeof(IValidateService)))
            .Returns(validateService);

            return(spMock);
        }
        public FabricProductService(IServiceProvider serviceProvider)
        {
            _categoryService       = serviceProvider.GetService <ICategoryService>();
            _uomService            = serviceProvider.GetService <IUOMService>();
            _productSKUService     = serviceProvider.GetService <IProductSKUService>();
            _productPackingService = serviceProvider.GetService <IProductPackingService>();

            _fabricProductSKURepository     = serviceProvider.GetService <IRepository <FabricProductSKUModel> >();
            _fabricProductPackingRepository = serviceProvider.GetService <IRepository <FabricProductPackingModel> >();
            _productPackingRepository       = serviceProvider.GetService <IRepository <ProductPackingModel> >();

            _upsertMaster = serviceProvider.GetService <IUpsertMasterService>();

            _identityProvider = serviceProvider.GetService <IIdentityProvider>();
        }
Example #3
0
        public Mock <IServiceProvider> GetServiceProvider(
            ICategoryService categoryService,
            IUOMService UOMService,
            IProductSKUService productSKUService,
            IProductPackingService productPackingService,
            IRepository <FabricProductSKUModel> fabricProductSKUModel,
            IRepository <FabricProductPackingModel> fabricProductPackingModel,
            IRepository <ProductPackingModel> productPackingModel,
            IUpsertMasterService upsertMasterService,
            IIdentityProvider identityProvider)
        {
            var serviceProviderMock = new Mock <IServiceProvider>();

            serviceProviderMock.Setup(s => s.GetService(typeof(ICategoryService)))
            .Returns(categoryService);

            serviceProviderMock.Setup(s => s.GetService(typeof(IUOMService)))
            .Returns(UOMService);

            serviceProviderMock.Setup(s => s.GetService(typeof(IProductSKUService)))
            .Returns(productSKUService);

            serviceProviderMock.Setup(s => s.GetService(typeof(IProductPackingService)))
            .Returns(productPackingService);

            serviceProviderMock.Setup(s => s.GetService(typeof(IRepository <FabricProductSKUModel>)))
            .Returns(fabricProductSKUModel);

            serviceProviderMock.Setup(s => s.GetService(typeof(IRepository <FabricProductPackingModel>)))
            .Returns(fabricProductPackingModel);

            serviceProviderMock.Setup(s => s.GetService(typeof(IRepository <ProductPackingModel>)))
            .Returns(productPackingModel);

            serviceProviderMock.Setup(s => s.GetService(typeof(IUpsertMasterService)))
            .Returns(upsertMasterService);

            serviceProviderMock.Setup(s => s.GetService(typeof(IIdentityProvider)))
            .Returns(identityProvider);

            return(serviceProviderMock);
        }
Example #4
0
 public ProductPackingController(IServiceProvider serviceProvider)
 {
     _service          = serviceProvider.GetService <IProductPackingService>();
     _identityProvider = serviceProvider.GetService <IIdentityProvider>();
     _validateService  = serviceProvider.GetService <IValidateService>();
 }