private void AppendResultOf(ExpectationResult expectationResult) { if (expectationResult != null) { ExpectationResults.Add(expectationResult); } }
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 VerifyDoesNotHaveInstance(IPolicyContainer policyContainer, DoesNotHaveInstanceExpectation expectation) { if (expectation == null) { return(null); } if (policyContainer != null && policyContainer.HasPolicy(expectation.Instance)) { const string messageFormat = "An unexpected instance of the policy type \"{2}\" was found for controller \"{0}\", action \"{1}\"."; var expectedPolicyType = expectation.Instance.GetType().Name; var message = string.Format(messageFormat, policyContainer.ControllerName, policyContainer.ActionName, expectedPolicyType); 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 VerifyHasInstance(IPolicyContainer policyContainer, HasInstanceExpectation 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.HasPolicy(expectation.Instance) == false) { const string messageFormat = "The expected instance of the policy \"{2}\" was not found! Controller \"{0}\", action \"{1}\"."; var expectedPolicyType = expectation.Instance.GetType().Name; var message = string.Format(messageFormat, policyContainer.ControllerName, policyContainer.ActionName, expectedPolicyType); return(_expectationViolationHandler.Handle(message)); } return(ExpectationResult.CreateSuccessResult()); }
private void AppendResultOf(ExpectationResult expectationResult) { if (expectationResult != null) ExpectationResults.Add(expectationResult); }