private void TestCreateAndVoidInout_0() { var documentNumber = Guid.NewGuid().ToString(); CreateInOut inOut = new CreateInOut(); inOut.DocumentNumber = documentNumber; inOut.CommandId = Guid.NewGuid().ToString(); inOut.DocumentAction = new DocumentAction(DocumentActionName.Draft);// 不能这样写:inOut.DocumentStatus = DocumentStatus.Drafted inOut.ChargeAmount = new Money(10000, "CNY"); inOut.FreightAmount = new Money(400, "CNY"); inOutApplicationService.When(inOut); MergePatchInOut patchInOut = new MergePatchInOut(); patchInOut.DocumentNumber = documentNumber; patchInOut.DocumentAction = new DocumentAction(DocumentActionName.Void);//不能这样写:patchInOut.DocumentStatus = DocumentStatus.Voided patchInOut.Version = 1; patchInOut.CommandId = Guid.NewGuid().ToString(); inOutApplicationService.When(patchInOut); var inOutResult = inOutApplicationService.Get(inOut.DocumentNumber); //Console.WriteLine(inOutResult.DocumentNumber); Assert.AreEqual(DocumentStatus.Voided, inOutResult.DocumentStatus); Console.WriteLine(inOutResult.FreightAmount); Assert.AreEqual(inOut.FreightAmount, inOutResult.FreightAmount); Console.WriteLine(inOutResult.ChargeAmount); Assert.AreEqual(inOut.ChargeAmount, inOutResult.ChargeAmount); }
public override void When(InOutCommands.AddLine c) { var inOut = AssertDocumentStatus(c.DocumentNumber, DocumentStatusIds.Drafted); var createLine = CreateInOutLine(c); var updateInOut = new MergePatchInOut(); updateInOut.DocumentNumber = c.DocumentNumber; updateInOut.Version = inOut.Version; updateInOut.CommandId = c.CommandId; updateInOut.RequesterId = c.RequesterId; updateInOut.InOutLineCommands.Add(createLine); When(updateInOut); }