Beispiel #1
0
        public void TestReturnHandlerCoR()
        {
            Trace.WriteLine("验证退货过程处理CoR");
            var head = new HandlerCoRFactory().CreateHandlerCoR(RequestOptions.Return);

            Assert.AreEqual <int>(4, head.Count());
            head.ToList().ForEach(x => x.HandleRequest(mailRequest));
            Assert.AreEqual <double>(OriginalPrice, mailRequest.Price);
        }
Beispiel #2
0
        public void TestReturnHandlerCoR()
        {
            Trace.Write("验证退货过程处理CoR");
            var head = new HandlerCoRFactory().CreateHandlerCoR(RequestOptions.Return);

            //  验证通过Lamada筛选出来的适用的Handler数量
            //  InternalHandler、MailReturnHandler、DiscountReturnHandler、RegularHandler
            Assert.AreEqual <int>(4, head.Count());
            head.ToList().ForEach(x => x.HandleRequest(mailRequest));
            //  验证邮购价格退货时只退还原价
            Assert.AreEqual <double>(OriginalPrice, mailRequest.Price);
        }
Beispiel #3
0
        public void TestPurchaseHandlerCoR()
        {
            Trace.Write("验证购买过程处理CoR");
            var head = new HandlerCoRFactory().CreateHandlerCoR(RequestOptions.Purchase);

            //  验证通过Lamada筛选出来的适用的Handler数量
            //  InternalHandler、MailPurchaseHandler、DiscountPurchaseHandler、RegularHandler
            Assert.AreEqual <int>(4, head.Count());
            head.ToList().ForEach(x => x.HandleRequest(mailRequest));
            //  验证购买时邮购价格是原价的1.3倍
            Assert.AreEqual <double>(OriginalPrice * 1.3, mailRequest.Price);
        }