public void Next_ShouldSetAlternatePolicy()
        {
            var sut             = new RestResponseHandlerPolicy(_mockRestResponse, (restResponse => true), restResponse => { });
            var alternatePolicy = new RestResponseHandlerPolicy(_mockRestResponse, (restResponse => true), restResponse => { });
            var returnVal       = sut.Next(alternatePolicy);

            Assert.AreSame(alternatePolicy, returnVal);
        }
        public void Evaluate_WhenNotMatchedAndAlteratePolicyExists_ShouldCallAlternatePolicy()
        {
            int result          = 0;
            var sut             = new RestResponseHandlerPolicy(_mockRestResponse, (restResponse => false), restResponse => { result = 1; });
            var alternatePolicy = new RestResponseHandlerPolicy(_mockRestResponse, (restResponse => true),
                                                                restResponse => { result = 2; });

            sut.Next(alternatePolicy);
            var handled = sut.Evaluate();

            Assert.IsTrue(handled);
            Assert.AreEqual(2, result);
        }
        public void Evaluate_WhenMatched_ShouldNotCallAlternatePolicy()
        {
            IRestResponse response        = Mock.Of <IRestResponse>();
            int           result          = 0;
            var           sut             = new RestResponseHandlerPolicy(_mockRestResponse, (restResponse => true), restResponse => { result = 1; });
            var           alternatePolicy = new RestResponseHandlerPolicy(_mockRestResponse, (restResponse => true),
                                                                          restResponse => { result = 2; });
            var handled = sut.Evaluate();

            sut.Next(alternatePolicy);
            Assert.IsTrue(handled);
            Assert.AreEqual(1, result);
        }