public void RejectStockAdjustmentMobile_Valid() { // Arrange var stockAdjustmentRepository = new StockAdjustmentRepository(context); var stockAdjustmentService = new StockAdjustmentService(context); var stockAdjustment = stockAdjustmentRepository.Save(new StockAdjustment() { StockAdjustmentId = "ADJAPPROVETEST", CreatedBy = new UserService(context).FindUserByEmail("*****@*****.**"), CreatedDateTime = DateTime.Now, Status = new StatusService(context).FindStatusByStatusId(4), StockAdjustmentDetails = new List <StockAdjustmentDetail>() { new StockAdjustmentDetail() { StockAdjustmentId = "ADJAPPROVETEST", ItemCode = "E030", Item = new ItemService(context).FindItemByItemCode("E030"), OriginalQuantity = 10, AfterQuantity = 10, } } }); // Act stockAdjustmentService.RejectStockAdjustment("ADJAPPROVETEST", "*****@*****.**"); // Assert Assert.AreEqual(5, stockAdjustment.Status.StatusId); Assert.IsTrue(new StockMovementRepository(context).FindByStockAdjustmentId("ADJAPPROVETEST").FirstOrDefault() == null); }
public void RejectStockAdjustmentMobile_AlreadyApproved_ThrowsException() { // Arrange var stockAdjustmentRepository = new StockAdjustmentRepository(context); var stockAdjustmentService = new StockAdjustmentService(context); var stockAdjustment = stockAdjustmentRepository.Save(new StockAdjustment() { StockAdjustmentId = "ADJAPPROVETEST", CreatedBy = new UserService(context).FindUserByEmail("*****@*****.**"), CreatedDateTime = DateTime.Now, Status = new StatusService(context).FindStatusByStatusId(6), StockAdjustmentDetails = new List <StockAdjustmentDetail>() { new StockAdjustmentDetail() { StockAdjustmentId = "ADJAPPROVETEST", ItemCode = "E030", Item = new ItemService(context).FindItemByItemCode("E030"), OriginalQuantity = 10, AfterQuantity = 10, } } }); // Act stockAdjustmentService.RejectStockAdjustment("ADJAPPROVETEST", "*****@*****.**"); }
public void TestInitialize() { // Arrange context = new ApplicationDbContext(); stockAdjustmentRepository = new StockAdjustmentRepository(context); stockAdjustmentDetailRepository = new StockAdjustmentDetailRepository(context); service = new StockAdjustmentService(context); itemRepository = new ItemRepository(context); inventoryRepository = new InventoryRepository(context); itemService = new ItemService(context); this.stockMovementRepository = new StockMovementRepository(context); //save new item object into db Item item = new Item(); item.ItemCode = "he06"; item.CreatedDateTime = DateTime.Now; itemRepository.Save(item); itemService.SaveInventory(item, 40); }