private void VerifyExpectationsOf(ExpectationGroup expectationGroup)
        {
            var controllerName = expectationGroup.Controller.GetControllerName();
            var actionName     = expectationGroup.Action;

            var policyContainer = _configuration.PolicyContainers.GetContainerFor(controllerName, actionName);

            // TODO: Apply open/closed principle. Extract each verifyer into it's own class.
            foreach (var expectation in expectationGroup.Expectations)
            {
                AppendResultOf(
                    VerifyHasType(policyContainer, expectation as HasTypeExpectation, controllerName, actionName)
                    );

                AppendResultOf(
                    VerifyHasInstance(policyContainer, expectation as HasInstanceExpectation, controllerName, actionName)
                    );

                AppendResultOf(
                    VerifyDoesNotHaveType(policyContainer, expectation as DoesNotHaveTypeExpectation)
                    );

                AppendResultOf(
                    VerifyDoesNotHaveInstance(policyContainer, expectation as DoesNotHaveInstanceExpectation)
                    );
            }
        }
        private void VerifyExpectationsOf(ExpectationGroup expectationGroup)
        {
            var controllerName = expectationGroup.Controller.GetControllerName();
            var actionName = expectationGroup.Action;

            var policyContainer = _configuration.PolicyContainers.GetContainerFor(controllerName, actionName);

            // TODO: Apply open/closed principle. Extract each verifyer into it's own class.
            foreach (var expectation in expectationGroup.Expectations)
            {
                AppendResultOf(
                    VerifyHasType(policyContainer, expectation as HasTypeExpectation, controllerName, actionName)
                    );

                AppendResultOf(
                    VerifyHasInstance(policyContainer, expectation as HasInstanceExpectation, controllerName, actionName)
                    );

                AppendResultOf(
                    VerifyDoesNotHaveType(policyContainer, expectation as DoesNotHaveTypeExpectation)
                    );

                AppendResultOf(
                    VerifyDoesNotHaveInstance(policyContainer, expectation as DoesNotHaveInstanceExpectation)
                    );
            }
        }
        private static IEnumerable<ExpectationGroup> CreateExpectationGroupsFor(ExpectationExpression expectationExpression)
        {
            var groups = new List<ExpectationGroup>();
            if (String.IsNullOrEmpty(expectationExpression.Action))
            {
                var actionMethods = expectationExpression.Controller.GetActionMethods();
                foreach (var expectationGroup in actionMethods.Select(actionMethod => new ExpectationGroup(expectationExpression.Controller, actionMethod.Name)))
                {
                    expectationExpression.Expectations.Each(expectationGroup.ApplyExpectation);
                    groups.Add(expectationGroup);
                }
            }
            else
            {
                var expectationGroup = new ExpectationGroup(expectationExpression.Controller, expectationExpression.Action);
                expectationExpression.Expectations.Each(expectationGroup.ApplyExpectation);
                groups.Add(expectationGroup);
            }

            return groups;
        }
        private static IEnumerable <ExpectationGroup> CreateExpectationGroupsFor(ExpectationExpression expectationExpression)
        {
            var groups = new List <ExpectationGroup>();

            if (String.IsNullOrEmpty(expectationExpression.Action))
            {
                var actionMethods = expectationExpression.Controller.GetActionMethods();
                foreach (var expectationGroup in actionMethods.Select(actionMethod => new ExpectationGroup(expectationExpression.Controller, actionMethod.GetActionName())))
                {
                    expectationExpression.Expectations.Each(expectationGroup.ApplyExpectation);
                    groups.Add(expectationGroup);
                }
            }
            else
            {
                var expectationGroup = new ExpectationGroup(expectationExpression.Controller, expectationExpression.Action);
                expectationExpression.Expectations.Each(expectationGroup.ApplyExpectation);
                groups.Add(expectationGroup);
            }

            return(groups);
        }