public void ShouldBeAbleAddStockItemToInventry() { var stockItem = _fixture.Create <StockItem>(); _sut.Add(stockItem); Assert.AreEqual(stockItem, _sut.GetById(stockItem.SKU)); }
public void Add() { if (IsEdit == true) { toEdit.ItemFrom = ItemFrom; toEdit.ItemTo = ItemTo; toEdit.DateOfArrival = DateOfArrival; toEdit.DateToSend = DateToSend; toEdit.Weight = Weight; toEdit.Status = Status; toEdit.Description = Description; InventoryService.Edit(toEdit); } else { var newInventory = new InventoryDTO(); newInventory.ItemFrom = ItemFrom; newInventory.ItemTo = ItemTo; newInventory.DateOfArrival = DateOfArrival; newInventory.DateToSend = DateToSend; newInventory.Weight = Weight; newInventory.Status = Status; newInventory.Description = Description; InventoryService.Add(newInventory); } Close(); }
private void GetItem() { var args = GetArgs(); if (args.Length != 10) { return; } var itemType = args[0]; var itemStats = args.Skip(1) .Select(s => Convert.ToDouble(s)) .ToArray(); Equippment item = null; switch (itemType) { case "weapon": item = new SimpleSword(); break; case "chest": item = new SimpleChest(); break; case "gloves": item = new SimpleGloves(); break; case "helmet": item = new SimpleHelmet(); break; } item.Level = (int)itemStats[0]; item.MainStat.Base = (long)itemStats[1]; item.MainStat.Koef = 1.0; item.MainStat.EnchantKoef = 1.0; item.Bonuses = new SomeName.Core.Items.Bonuses.ItemBonuses(); item.Bonuses.Power.Base = (int)itemStats[2]; item.Bonuses.Power.Koef = 1.0; item.Bonuses.Vitality.Base = (int)itemStats[3]; item.Bonuses.Vitality.Koef = 1.0; item.Bonuses.Accuracy.Base = (int)itemStats[4]; item.Bonuses.Accuracy.Koef = 1.0; item.Bonuses.Evasion.Base = (int)itemStats[5]; item.Bonuses.Evasion.Koef = 1.0; item.Bonuses.CritChance.Base = itemStats[6]; item.Bonuses.CritChance.Koef = 1.0; item.Bonuses.CritDamage.Base = itemStats[7]; item.Bonuses.CritDamage.Koef = 1.0; item.Bonuses.HealthPerHit.Base = (long)itemStats[8]; item.Bonuses.HealthPerHit.Koef = 1.0; item.UpdateGoldValueKoef(); _inventoryService.Add(item); }
public void InventoryServiceAdd_UnitOfWorkAddAndComplete_ReturnsUnitOfWorkAddAndComplete() { var inventoryDto = new InventoryDto() { Name = "Test" }; var entity = Mapper.Map <InventoryDto, Inventory>(inventoryDto); _inventoryService.Add(inventoryDto); _uow.Received().Inventories.Add(entity); _uow.Received().Complete(); }
public void Add_Inventory_To_Db() { var mockDbSet = new Mock <DbSet <Inventory> >(); var mockContext = new Mock <RentalContext>(); mockContext.Setup(d => d.Inventory).Returns(mockDbSet.Object); var svc = new InventoryService(mockContext.Object); svc.Add(new Inventory()); mockContext.Verify(a => a.Add(It.IsAny <Inventory>()), Times.Once); mockContext.Verify(s => s.SaveChanges(), Times.Once); }
private void btnAdd_Click(object sender, EventArgs e) { if (IsNameEmpty()) { return; } if (StockInService.IsNameExisted(txtBatch.Text.Trim())) { MessageBox.Show("This " + txtBatch.Text.Trim() + " already exists."); } else { int productId = Convert.ToInt32(txtProductId.Text.Trim()); Product product = ProductService.GetProductById(productId); string batch = txtBatch.Text; int count = Convert.ToInt32(txtCount.Text.Trim()); decimal subTotal = Convert.ToDecimal(txtSubtotal.Text.Trim()); int userId = UserLogined.UserId; DateTime inStockTime = dtpInStockTime.Value; StockIn stockIn = new StockIn() { ProductId = productId, Batch = batch, Count = count, Subtotal = subTotal, UserId = userId, InStockTime = inStockTime }; int stockInId = StockInService.Add(stockIn); int supplierId = Convert.ToInt32(txtSupplierId.Text); Inventory inventory = new Inventory() { ProductId = productId, SupplierId = supplierId, Batch = batch, Count = count, Price = product.SellingPrice, InStockTime = DateTime.Now, StockInId = stockInId }; InventoryService.Add(inventory); } ResetUIInputtdData(); }
public void Add() { var newInventory = new InventoryDTO(); newInventory.ItemFrom = ItemFrom; newInventory.ItemTo = ItemTo; newInventory.DateOfArrival = DateOfArrival; newInventory.DateToSend = DateToSend; newInventory.Weight = Weight; newInventory.Status = Status; newInventory.Description = Description; InventoryService.Add(newInventory); TryClose(); }
static void Main(string[] args) { Console.WriteLine("Start test the application"); InventoryService ps = new InventoryService(); ps.Add(new Data.Entities.Inventory() { ProductId = 1, InventoryId = 1000, Qty = 7 }); Console.WriteLine("test done"); Console.Read(); }
/// <summary> /// Add /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { if (IsInputeNull()) { return; } var Inventory = new Inventory(); if (InventoryService.IsNameExisted(txtBatch.Text.Trim())) { MessageBox.Show("This " + txtBatch.Text.Trim() + " has already existed."); } else { Inventory.Batch = txtBatch.Text; //Inventory.CompanyId = (int)cboCompany.SelectedValue; InventoryService.Add(Inventory); } BindData(); ReloadForm(); }
private void button2_Click(object sender, EventArgs e) //add { if (this.product == null) { MessageBox.Show("Select a product first"); } else { Inventory newInventory = new Inventory() { Qty = int.Parse(textBox7.Text), Description = textBox8.Text, ProductId = this.product.ProductId, //Product = productService.GetById(this.product.ProductId) }; inventoryService.Add(newInventory); RefreshInventoryDataBinding(); RefreshProductDataBinding(); } ClearInventoryControlForm(); this.product = null; this.inventory = null; }
public async Task Add_Return_InventoryId_Zero() { var expected = new Inventory() { Id = 1 }; var input = new InventoryDTO() { Id = 1 }; _repository.Setup(s => s.Add(It.IsAny <Inventory>())).ReturnsAsync(expected); var actual = await _service.Add(input); Assert.IsNotNull(actual); Assert.AreEqual(false, actual.IsSucceeded); Assert.AreEqual("Inventory id should be zero while adding", actual.GetErrorString()); }
public void TakeDrop(Drop drop) { TakeExp(drop.Exp); InventoryService.Add(drop); }
public IActionResult Post([FromBody] Inventory Inventory) { _inventoryService.Add(Inventory); return(new JsonResult(Inventory)); }