public void CanCreateInvocationDelegateFor_CalledMultipleTimes_ExpectEnumerableOfInnerInvocationsIsOnlyEnumeratedOnce(
            MethodInfo method1, MethodInfo method2)
        {
            var innerInvocations = Mock.Enumerable <IServiceMethodInvocation>();
            var chain            = new ServiceMethodInvocationChain(innerInvocations);

            chain.CanCreateInvocationDelegateFor(method1);
            chain.CanCreateInvocationDelegateFor(method2);

            innerInvocations.AssertWasCalled(x => x.GetEnumerator(), x => x.Repeat.Once());
        }
		public void CanCreateInvocationDelegateFor_CalledWhenAllInnerInvocationsReturnFalse_ExpectFalseIsReturned(
			[WithinInclusiveRange(1, 10)] int numberOfInnerInvocations, MethodInfo method)
		{
			var innerInvocations = CreateNumberOfStubServiceMethodInvocationsUnableToCreateDelegate(numberOfInnerInvocations, method);
			var chain = new ServiceMethodInvocationChain(innerInvocations);
			chain.CanCreateInvocationDelegateFor(method).Should().BeFalse();
		}
        public void CanCreateInvocationDelegateFor_CalledWhenAllInnerInvocationsReturnFalse_ExpectFalseIsReturned(
            [WithinInclusiveRange(1, 10)] int numberOfInnerInvocations, MethodInfo method)
        {
            var innerInvocations = CreateNumberOfStubServiceMethodInvocationsUnableToCreateDelegate(numberOfInnerInvocations, method);
            var chain            = new ServiceMethodInvocationChain(innerInvocations);

            chain.CanCreateInvocationDelegateFor(method).Should().BeFalse();
        }
		public void CanCreateInvocationDelegateFor_CalledWhenAtLeastOneInnerInvocationReturnsTrue_ExpectTrueIsReturned(
			[WithinInclusiveRange(0, 10)] int numberOfFalseInnerInvocations,
			[WithinInclusiveRange(1, 10)] int numberOfTrueInnerInvocations,
			MethodInfo method)
		{
			var falseInvocations = CreateNumberOfStubServiceMethodInvocationsUnableToCreateDelegate(numberOfFalseInnerInvocations, method);
			var trueInvocations = CreateNumberOfStubServiceMethodInvocationsAbleToCreateDelegate(numberOfTrueInnerInvocations, method);

			var chain = new ServiceMethodInvocationChain(falseInvocations.Concat(trueInvocations).Shuffle());
			chain.CanCreateInvocationDelegateFor(method).Should().BeTrue();
		}
        public void CanCreateInvocationDelegateFor_CalledWhenAtLeastOneInnerInvocationReturnsTrue_ExpectTrueIsReturned(
            [WithinInclusiveRange(0, 10)] int numberOfFalseInnerInvocations,
            [WithinInclusiveRange(1, 10)] int numberOfTrueInnerInvocations,
            MethodInfo method)
        {
            var falseInvocations = CreateNumberOfStubServiceMethodInvocationsUnableToCreateDelegate(numberOfFalseInnerInvocations, method);
            var trueInvocations  = CreateNumberOfStubServiceMethodInvocationsAbleToCreateDelegate(numberOfTrueInnerInvocations, method);

            var chain = new ServiceMethodInvocationChain(falseInvocations.Concat(trueInvocations).Shuffle());

            chain.CanCreateInvocationDelegateFor(method).Should().BeTrue();
        }
		public void CanCreateInvocationDelegateFor_CalledMultipleTimes_ExpectEnumerableOfInnerInvocationsIsOnlyEnumeratedOnce(
			MethodInfo method1, MethodInfo method2)
		{
			var innerInvocations = Mock.Enumerable<IServiceMethodInvocation>();
			var chain = new ServiceMethodInvocationChain(innerInvocations);
			chain.CanCreateInvocationDelegateFor(method1);
			chain.CanCreateInvocationDelegateFor(method2);

			innerInvocations.AssertWasCalled(x => x.GetEnumerator(), x => x.Repeat.Once());
		}