示例#1
0
        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);
        }
示例#2
0
        private void TestReverseInOut(string documentNumber)
        {
            var reverse = new InOutCommands.Reverse();

            reverse.CommandId      = Guid.NewGuid().ToString();
            reverse.Version        = 2;
            reverse.DocumentNumber = documentNumber;
            inOutApplicationService.When(reverse);
        }