Ejemplo n.º 1
0
        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>();
        }
Ejemplo n.º 2
0
 public ExcelController(ITransactionService transactionService, IReportService reportService,
                        ISupplyService supplyService)
 {
     this._transactionService = transactionService;
     this._reportService      = reportService;
     this._supplyService      = supplyService;
 }
Ejemplo n.º 3
0
 public ExcelController(ITransactionService transactionService, IReportService reportService,
                        ISupplyService supplyService, IAccountTransactionActivityService accountTransactionActivityService)
 {
     this._transactionService = transactionService;
     this._reportService      = reportService;
     this._supplyService      = supplyService;
     this._accountTransactionActivityService = accountTransactionActivityService;
 }
Ejemplo n.º 4
0
 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);
        }
Ejemplo n.º 6
0
 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);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 12
0
 public CreateSupplyTest()
 {
     _supplyService = LocalIocManager.Resolve<ISupplyService>();
     _userAppService = LocalIocManager.Resolve<IUserAppService>();
     _userManager = LocalIocManager.Resolve<UserManager>();
 }
Ejemplo n.º 13
0
 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;
 }
Ejemplo n.º 15
0
 public MaterialsController(IStoreService storeService, ISupplyService supplyService)
 {
     _storeService  = storeService ?? throw new ArgumentNullException(nameof(storeService));
     _supplyService = supplyService ?? throw new ArgumentNullException(nameof(supplyService));
 }
Ejemplo n.º 16
0
 public SupplyController(ISupplyService supplyService, IProductService productService, IMapper mapper)
 {
     _productService = productService;
     _supplyService  = supplyService;
     _mapper         = mapper;
 }
Ejemplo n.º 17
0
 public CreatePurchaseOrder()
 {
     _supplyService = LocalIocManager.Resolve<ISupplyService>();
     _orderService = LocalIocManager.Resolve<IOrderService>();
     _userManager = LocalIocManager.Resolve<UserManager>();
 }
Ejemplo n.º 18
0
 public SupplyController(ISupplyService supplyService, IVehicleService vehicleService)
 {
     this.supplyService  = supplyService;
     this.vehicleService = vehicleService;
 }
Ejemplo n.º 19
0
 public TransactionsController(ISupplyService supplyService)
 {
     _supplyService = supplyService ?? throw new ArgumentNullException(nameof(supplyService));
 }
Ejemplo n.º 20
0
 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);
 }