void ProduceAndCheck <T>(DataProducer <T> source, IDataProducer <T> result, T[] inputData, T[] expectedOutput) { IEnumerable <T> enumerable = result.AsEnumerable(); source.ProduceAndEnd(inputData); Assert.IsTrue(expectedOutput.SequenceEqual(enumerable)); }