public void WhenCreateResponseHandlerIsCalledThenActionIsCalledOnHandlerItem()
 {
     bool actionCalled = false;
     var handlerItem = new OperationHandlerItem(c => actionCalled = true, (e, o) => true);
     var handlers = new List<OperationHandlerItem> { handlerItem };
     var factory = new DelegateOperationHandlerFactory(Enumerable.Empty<MediaTypeFormatter>(),null,handlers);
     var contract = ContractDescription.GetContract(typeof(DummyService));
     factory.CreateResponseHandlers(new HttpEndpoint(contract), new HttpOperationDescription());
     Assert.IsTrue(actionCalled);
 }
        public void WhenCreateRequestHandlersIsCalledThenActionIsCalledOnHandlerItem()
        {
            bool actionCalled = false;
            var  handlerItem  = new OperationHandlerItem(c => actionCalled = true, (e, o) => true);
            var  handlers     = new List <OperationHandlerItem> {
                handlerItem
            };
            var factory  = new DelegateOperationHandlerFactory(Enumerable.Empty <MediaTypeFormatter>(), handlers, null);
            var contract = ContractDescription.GetContract(typeof(DummyService));

            factory.CreateRequestHandlers(new HttpEndpoint(contract), new HttpOperationDescription());
            Assert.IsTrue(actionCalled);
        }
 public void WhenCreateRequestHandlersIsCalledThenConditionIsCheckedOnHandlerItem()
 {
     bool conditionChecked = false;
     var handlerItem = new OperationHandlerItem(c => { }, (e, o) =>
     {
         conditionChecked = true;
         return true;
     });
     var handlers = new List<OperationHandlerItem> { handlerItem };
     var factory = new DelegateOperationHandlerFactory(Enumerable.Empty<MediaTypeFormatter>(), handlers, null);
     var contract = ContractDescription.GetContract(typeof (DummyService));
     factory.CreateRequestHandlers(new HttpEndpoint(contract), new HttpOperationDescription());
     Assert.IsTrue(conditionChecked);
 }
        public void WhenCreateResponseHandlersIsCalledThenConditionIsCheckedOnHandlerItem()
        {
            bool conditionChecked = false;
            var  handlerItem      = new OperationHandlerItem(c => { }, (e, o) =>
            {
                conditionChecked = true;
                return(true);
            });
            var handlers = new List <OperationHandlerItem> {
                handlerItem
            };
            var factory  = new DelegateOperationHandlerFactory(Enumerable.Empty <MediaTypeFormatter>(), null, handlers);
            var contract = ContractDescription.GetContract(typeof(DummyService));

            factory.CreateResponseHandlers(new HttpEndpoint(contract), new HttpOperationDescription());
            Assert.IsTrue(conditionChecked);
        }