public void TestInsertAndGetByUidWithDecimalQuantity() { InventoryTransferProxy proxy = new InventoryTransferProxy(); InventoryTransferDto dto1 = this.GetInventoryTransfer4(); proxy.Insert(dto1); Assert.IsTrue(dto1.Uid > 0, "Uid must be > 0 after save."); InventoryTransferDto dto2 = (InventoryTransferDto)proxy.GetByUid(dto1.Uid); AssertEqual(dto1, dto2); }
public void TestInsertAndGetByUidDoNotBalance() { InventoryTransferProxy proxy = new InventoryTransferProxy(); InventoryTransferDto dto1 = this.GetInventoryTransfer3(); try { proxy.Insert(dto1); throw new Exception("Expected exception not thrown."); } catch (RestException rex) { Assert.AreEqual("The Inventory Transfer is not balanced. The total of all line items must equal to 0.", rex.Message, "Incorrect error message."); } }
public void TestDelete() { CrudProxy proxy = new InventoryTransferProxy(); InventoryTransferDto dto1 = this.GetInventoryTransfer1(); proxy.Insert(dto1); proxy.DeleteByUid(dto1.Uid); try { proxy.GetByUid(dto1.Uid); throw new Exception("The expected exception was not thrown."); } catch (RestException ex) { Assert.AreEqual("RecordNotFoundException", ex.Type, "Incorrect exception type."); } }
public void TestUpdate() { InventoryTransferProxy proxy = new InventoryTransferProxy(); InventoryTransferDto dto1 = this.GetInventoryTransfer1(); proxy.Insert(dto1); Assert.IsTrue(dto1.Uid > 0, "Uid must be > 0 after save."); dto1.Notes = "Updated inventory transfer"; dto1.Items.AddRange(this.GetInventoryTransfer2().Items); proxy.Update(dto1); InventoryTransferDto dto2 = (InventoryTransferDto)proxy.GetByUid(dto1.Uid); AssertEqual(dto1, dto2); }