Exemple #1
0
 public DetailCMGarmentByUnitReportFacade(IServiceProvider serviceProvider, SalesDbContext dbContext)
 {
     this.DbContext       = dbContext;
     this.DbSet           = this.DbContext.Set <CostCalculationGarment>();
     this.IdentityService = serviceProvider.GetService <IdentityService>();
     this.DetailCMGarmentByUnitReportLogic = serviceProvider.GetService <DetailCMGarmentByUnitReportLogic>();
 }
Exemple #2
0
        protected virtual Mock <IServiceProvider> GetServiceProviderMock(SalesDbContext dbContext)
        {
            var serviceProviderMock = new Mock <IServiceProvider>();

            IIdentityService identityService = new IdentityService {
                Username = "******"
            };

            CostCalculationGarmentMaterialLogic costCalculationGarmentMaterialLogic = new CostCalculationGarmentMaterialLogic(serviceProviderMock.Object, identityService, dbContext);
            CostCalculationGarmentLogic         costCalculationGarmentLogic         = new CostCalculationGarmentLogic(costCalculationGarmentMaterialLogic, serviceProviderMock.Object, identityService, dbContext);
            DetailCMGarmentByUnitReportLogic    detailCMGarmentByUnitReportLogic    = new DetailCMGarmentByUnitReportLogic(identityService, dbContext);

            GarmentPreSalesContractLogic garmentPreSalesContractLogic = new GarmentPreSalesContractLogic(identityService, dbContext);

            var azureImageFacadeMock = new Mock <IAzureImageFacade>();

            azureImageFacadeMock
            .Setup(s => s.DownloadImage(It.IsAny <string>(), It.IsAny <string>()))
            .ReturnsAsync("");

            serviceProviderMock
            .Setup(x => x.GetService(typeof(IdentityService)))
            .Returns(identityService);
            serviceProviderMock
            .Setup(x => x.GetService(typeof(CostCalculationGarmentLogic)))
            .Returns(costCalculationGarmentLogic);
            serviceProviderMock
            .Setup(x => x.GetService(typeof(GarmentPreSalesContractLogic)))
            .Returns(garmentPreSalesContractLogic);

            serviceProviderMock
            .Setup(x => x.GetService(typeof(DetailCMGarmentByUnitReportLogic)))
            .Returns(detailCMGarmentByUnitReportLogic);

            serviceProviderMock
            .Setup(x => x.GetService(typeof(IAzureImageFacade)))
            .Returns(azureImageFacadeMock.Object);

            return(serviceProviderMock);
        }