public void AssertEarlyBreakToArrayBehaviour(Func <int[]> testedAction, int inputCount, int breakAfter) { StubCollection.ResetStatistics(); var array = testedAction(); Assert.AreEqual(Math.Min(inputCount, breakAfter), array.Length); StubCollection.VeryfiEnumerateBechaviourAfterEarlyBreakAndReset(inputCount, breakAfter); }
public void AssertEarlyBreakIEnumerableBehaviour(Func <IEnumerable <int> > testedAction, int inputCount, int breakAfter) { StubCollection.ResetStatistics(); var result = testedAction(); Assert.AreEqual(Math.Min(inputCount, breakAfter), result.Count()); StubCollection.VeryfiEnumerateBechaviourAfterEarlyBreakAndReset(inputCount, breakAfter); Assert.AreEqual(Math.Min(inputCount, breakAfter), Enumerate(testedAction()).count); StubCollection.VeryfiEnumerateBechaviourAfterEarlyBreakAndReset(inputCount, breakAfter); AssertCorrectEnumeratorBehaviour(testedAction().GetEnumerator()); StubCollection.VeryfiEnumerateBechaviourAfterEarlyBreakAndReset(inputCount, breakAfter); Assert.Throws <NotImplementedException>(() => testedAction().GetEnumerator().Reset()); }