public Spec AnyNonCachedRequestHandledAfterAndIncludingTheFirstExceptionCallsTheCreateDefaultResponseMethod()
        {
            return(new Spec(
                       () =>
            {
                var requestsAfterTheFirstException =
                    input
                    .Select(tuple => tuple.Item1)
                    .Skip(ProcessRequestsState.GetIndexOfFirstExceptionThrown());

                var requestTypes =
                    requestsAfterTheFirstException
                    .Select(request => request.GetType())
                    .Distinct()
                    .Where(type => !type.HasAttribute <EnableServiceResponseCachingAttribute>());

                requestTypes.ForEach(
                    type =>
                    Ensure.Equal(
                        requestsAfterTheFirstException.Count(request => request.GetType() == type),
                        ProcessRequestsState.GetHandler(type).DefaultResponseReturned));
            })
                   .IfAfter(ProcessRequestsState.ExceptionWasThrownBeforeLastRequest));
        }
        public Spec AnyNonCachedRequestHandledBeforeTheFirstExceptionCallsTheHandleMethod()
        {
            return(new Spec(
                       () =>
            {
                var nonFailedRequests =
                    input
                    .Select(tuple => tuple.Item1)
                    .Take(ProcessRequestsState.GetIndexOfFirstExceptionThrown() + 1);

                var requestTypes =
                    nonFailedRequests
                    .Select(request => request.GetType())
                    .Distinct()
                    .Where(type => !type.HasAttribute <EnableServiceResponseCachingAttribute>());

                requestTypes.ForEach(
                    type =>
                    Ensure.Equal(
                        nonFailedRequests.Count(request => request.GetType() == type),
                        ProcessRequestsState.GetHandler(type).HandledRequest));
            })
                   .IfAfter(ProcessRequestsState.ExceptionWasThrownAfterTheFirstRequest));
        }