public void SetUp() { var builder = new ConfigurationBuilder(). SetBasePath(Directory.GetCurrentDirectory()). AddJsonFile("appsettings.json"); Configuration = builder.Build(); var serviceCollection = new ServiceCollection(); serviceCollection.AddDbContext <ProductContext>(options => options.UseSqlServer(Configuration.GetConnectionString("ProductContext"))); serviceCollection.AddScoped <ICalculateProductPrice, CalculateProductPrice>(); serviceCollection.AddScoped <IReceiptService, ReceiptService>(); serviceCollection.AddScoped <IRegisterService, RegisterService>(); serviceCollection.AddScoped <IProductService, ProductService>(); serviceCollection.AddScoped <ISupplyService, SupplyService>(); serviceCollection.AddScoped <IMapperService, MapperService>(); var serviceProvider = serviceCollection.BuildServiceProvider(); CalculateProductPrice = serviceProvider.GetService <ICalculateProductPrice>(); ReceiptService = serviceProvider.GetService <IReceiptService>(); RegisterService = serviceProvider.GetService <IRegisterService>(); ProductService = serviceProvider.GetService <IProductService>(); SupplyService = serviceProvider.GetService <ISupplyService>(); }
public ExcelController(ITransactionService transactionService, IReportService reportService, ISupplyService supplyService) { this._transactionService = transactionService; this._reportService = reportService; this._supplyService = supplyService; }
public ExcelController(ITransactionService transactionService, IReportService reportService, ISupplyService supplyService, IAccountTransactionActivityService accountTransactionActivityService) { this._transactionService = transactionService; this._reportService = reportService; this._supplyService = supplyService; this._accountTransactionActivityService = accountTransactionActivityService; }
public ReportService(IReportDataService dataService, IUserService userService, ITransactionService transactionService, ISupplyService supplyService) { this._dataService = dataService; this._userService = userService; this._transactionService = transactionService; this._supplyService = supplyService; }
public async Task Put_BadParams_ReturnBadRequest() { //Arrange ISupplyService supplyServiceStub = Substitute.For <ISupplyService>(); //Act IActionResult badRequestObjectResult = await new SuppliesController(supplyServiceStub).Put(0, null); //Assert Assert.IsType <BadRequestObjectResult>(badRequestObjectResult); }
public BatchService(IBatchDataService dataService, IUserService userService, ISupplyDataService supplyDataService, IFactoryExpenseService factoryExpenseService, ILabourCostService labourCostService, IMachineRepairService machineRepairService, IOtherExpenseService otherExpenseService, IBatchOutPutService batchOutPutService, ISupplyService supplyService) { this._dataService = dataService; this._userService = userService; this._supplyDataService = supplyDataService; this._factoryExpenseService = factoryExpenseService; this._labourCostService = labourCostService; this._machineRepairService = machineRepairService; this._otherExpenseService = otherExpenseService; this._batchOutPutService = batchOutPutService; this._supplyService = supplyService; }
public async Task Delete_GoodParams_ReturnNotFound() { //Arrange ISupplyService supplyServiceStub = Substitute.For <ISupplyService>(); supplyServiceStub.GetAsync(Arg.Any <long>()).Returns(x => (Supply)null); supplyServiceStub.RemoveAsync(Arg.Any <Supply>()).Returns(Task.FromResult(true)); //Act IActionResult notFoundObjectResult = await new SuppliesController(supplyServiceStub).Delete(1); //Assert Assert.IsType <NotFoundObjectResult>(notFoundObjectResult); }
public async Task Delete_GoodParams_ReturnOk() { //Arrange ISupplyService supplyServiceStub = Substitute.For <ISupplyService>(); supplyServiceStub.GetAsync(Arg.Any <long>()).Returns(x => new Supply(1, 1, DateTimeOffset.Now, 10)); supplyServiceStub.RemoveAsync(Arg.Any <Supply>()).Returns(Task.FromResult(true)); //Act IActionResult okResult = await new SuppliesController(supplyServiceStub).Delete(1); //Assert Assert.IsType <OkResult>(okResult); }
public SupplyViewModel( IBaseService baseService, ISupplyService supplyService, IEventAggregator eventAggregator ) : base(baseService) { _baseService = baseService; _supplyService = supplyService; _eventAggregator = eventAggregator; ModifySilverToSupply = new DelegateCommand(ExecuteModifySilverToSupply); ModifyBaseToSupply = new DelegateCommand(ExecuteModifyBaseToSupply); ModifyLuxuryToSupply = new DelegateCommand(ExecuteModifyLuxuryToSupply); ModifyIronToSupply = new DelegateCommand(ExecuteModifyIronToSupply); ModifyStoneToSupply = new DelegateCommand(ExecuteModifyStoneToSupply); ModifyWoodToSupply = new DelegateCommand(ExecuteModifyWoodToSupply); _eventAggregator.GetEvent <NewFiefLoadedEvent>().Subscribe(ExecuteNewFiefLoadedEvent); }
public async Task Post_GoodParams_ReturnOk() { //Arrange ISupplyService supplyServiceStub = Substitute.For <ISupplyService>(); SupplyCreateModel supplyCreateModel = new SupplyCreateModel() { Provider = new ProviderModel(new Provider()), Supplies = new List <SupplyCreateModel.SupplyCreateRowModel>(), ProvideDate = DateTimeOffset.Now }; //Act IActionResult okResult = await new SuppliesController(supplyServiceStub).Post(supplyCreateModel); //Assert Assert.IsType <OkResult>(okResult); }
public async Task Post_BadParamsInvalid_BadRequest() { //Arrange ISupplyService supplyServiceStub = Substitute.For <ISupplyService>(); SupplyCreateModel supplyCreateModel = new SupplyCreateModel() { Provider = null, ProvideDate = DateTimeOffset.Now }; SuppliesController suppliesController = new SuppliesController(supplyServiceStub); suppliesController.ModelState.AddModelError("Name", "Required"); //Act IActionResult badRequestObjectResult = await suppliesController.Post(supplyCreateModel); //Assert Assert.IsType <BadRequestObjectResult>(badRequestObjectResult); }
public CreateSupplyTest() { _supplyService = LocalIocManager.Resolve<ISupplyService>(); _userAppService = LocalIocManager.Resolve<IUserAppService>(); _userManager = LocalIocManager.Resolve<UserManager>(); }
public WareHouseController(ISupplyService supplyService, IImportPaperService importPaperService, IExportPaperService exportPaperService) { this._supplyService = supplyService; this._importPaperService = importPaperService; this._exportPaperService = exportPaperService; }
public SupplyController(ILogger <SupplyController> logger, ISupplyService voorraadService, IProductService productService) { _supplyService = voorraadService; _productService = productService; _logger = logger; }
public MaterialsController(IStoreService storeService, ISupplyService supplyService) { _storeService = storeService ?? throw new ArgumentNullException(nameof(storeService)); _supplyService = supplyService ?? throw new ArgumentNullException(nameof(supplyService)); }
public SupplyController(ISupplyService supplyService, IProductService productService, IMapper mapper) { _productService = productService; _supplyService = supplyService; _mapper = mapper; }
public CreatePurchaseOrder() { _supplyService = LocalIocManager.Resolve<ISupplyService>(); _orderService = LocalIocManager.Resolve<IOrderService>(); _userManager = LocalIocManager.Resolve<UserManager>(); }
public SupplyController(ISupplyService supplyService, IVehicleService vehicleService) { this.supplyService = supplyService; this.vehicleService = vehicleService; }
public TransactionsController(ISupplyService supplyService) { _supplyService = supplyService ?? throw new ArgumentNullException(nameof(supplyService)); }
public RealOrderBridge() { _market = MarketYard.Instance; _supplyService = _market.GetSupplyService(); _paymentService = _market.GetPaymentService(); }
public SupplyApiController(ISupplyService SupplyService, IUserService userService) { this._SupplyService = SupplyService; this._userService = userService; userId = Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(RequestContext.Principal.Identity); }