public void TestReturnHandlerCor() { Trace.WriteLine("验证退货过程处理Cor"); var head = new HandlerCorFactory().CreateHandlerCor(RequestOptions.Return); // 验证通过Lamada筛选出来的适用的Handler数量 // InternalHandler、MailReturnHandler、DiscountReturnHandler、RegularHandler Assert.AreEqual(4, head.Count()); head.ToList().ForEach(x => x.HandleRequest(mailRequest)); // 验证邮购价格退货时只退还原价 Assert.AreEqual(OriginalPrice, mailRequest.Price); }
public void TestPurchaseHandlerCor() { Trace.Write("验证购买过程处理CoR"); var head = new HandlerCorFactory().CreateHandlerCor(RequestOptions.Purchase); // 验证通过Lamada筛选出来的适用的Handler数量 // InternalHandler、MailPurchaseHandler、DiscountPurchaseHandler、RegularHandler Assert.AreEqual(4, head.Count()); head.ToList().ForEach(x => x.HandleRequest(mailRequest)); Assert.AreEqual(OriginalPrice * 1.3, mailRequest.Price); }