public void CorTest3() { CoRHandlerBase <Request> handler1 = new InternalHandler(); CoRHandlerBase <Request> handler2 = new MailHandler(); CoRHandlerBase <Request> handler3 = new DiscountHandler(); CoRHandlerBase <Request> handler4 = new RegularHandler(); CoRHandlerBase <Request> handler5 = new Regular2Handler(); var request = new Request(20, "Mail"); handler1.AddSuccessor(handler3); handler3.AddSuccessor(handler2); handler3.AddSuccessor(handler5); handler3.AddSuccessor(handler4); handler1.HandleRequest(request); Assert.AreEqual <double>(20 * 1.3 * 10 * 5, request.Price); }
public void CorTest2() { CoRHandlerBase <Request> handler1 = new InternalHandler(); CoRHandlerBase <Request> handler2 = new MailHandler(); CoRHandlerBase <Request> handler3 = new DiscountHandler(); handler3.HasBreakPoint = true; handler3.Break += Handler1_Break; var request = new Request(20, "Mail"); handler1.HandleRequest(request); handler1.AddSuccessor(handler3); handler3.AddSuccessor(handler2); Assert.AreEqual <double>(20, request.Price); }