private ExpectationResult VerifyDoesNotHaveType(IPolicyContainer policyContainer, DoesNotHaveTypeExpectation expectation)
 {
     if (expectation == null)
     {
         return(null);
     }
     if (policyContainer != null && policyContainer.HasPolicyMatching(expectation))
     {
         const string messageFormat = "An unexpected policy of type \"{2}\" was found for controller \"{0}\", action \"{1}\".{3}";
         var          message       = string.Format(messageFormat, policyContainer.ControllerName, policyContainer.ActionName, expectation.Type, GetPredicateDescription(expectation));
         return(_expectationViolationHandler.Handle(message));
     }
     return(ExpectationResult.CreateSuccessResult());
 }
        private ExpectationResult VerifyHasType(IPolicyContainer policyContainer, HasTypeExpectation expectation, string controllerName, string actionName)
        {
            if (expectation == null)
            {
                return(null);
            }
            if (policyContainer == null)
            {
                const string messageFormat = "Expected a configuration for controller \"{0}\", action \"{1}\". Policycontainer could not be found!";
                var          message       = string.Format(messageFormat, controllerName, actionName);
                return(_expectationViolationHandler.Handle(message));
            }

            if (policyContainer.HasPolicyMatching(expectation) == false)
            {
                const string messageFormat = "Expected policy of type \"{2}\" for controller \"{0}\", action \"{1}\".{3}";
                var          message       = string.Format(messageFormat, policyContainer.ControllerName, policyContainer.ActionName, expectation.Type, GetPredicateDescription(expectation));
                return(_expectationViolationHandler.Handle(message));
            }
            return(ExpectationResult.CreateSuccessResult());
        }
 private ExpectationResult VerifyDoesNotHaveType(IPolicyContainer policyContainer, DoesNotHaveTypeExpectation expectation)
 {
     if (expectation == null) return null;
     if (policyContainer != null && policyContainer.HasPolicyMatching(expectation))
     {
         const string messageFormat = "An unexpected policy of type \"{2}\" was found for controller \"{0}\", action \"{1}\".{3}";
         var message = string.Format(messageFormat, policyContainer.ControllerName, policyContainer.ActionName, expectation.Type, GetPredicateDescription(expectation));
         return _expectationViolationHandler.Handle(message);
     }
     return ExpectationResult.CreateSuccessResult();
 }
        private ExpectationResult VerifyHasType(IPolicyContainer policyContainer, HasTypeExpectation expectation, string controllerName, string actionName)
        {
            if (expectation == null) return null;
            if (policyContainer == null)
            {
                const string messageFormat = "Expected a configuration for controller \"{0}\", action \"{1}\". Policycontainer could not be found!";
                var message = string.Format(messageFormat, controllerName, actionName);
                return _expectationViolationHandler.Handle(message);
            }

            if (policyContainer.HasPolicyMatching(expectation) == false)
            {
                const string messageFormat = "Expected policy of type \"{2}\" for controller \"{0}\", action \"{1}\".{3}";
                var message = string.Format(messageFormat, policyContainer.ControllerName, policyContainer.ActionName, expectation.Type, GetPredicateDescription(expectation));
                return _expectationViolationHandler.Handle(message);
            }
            return ExpectationResult.CreateSuccessResult();
        }