public void Next_InvokesFuncWithExpectedArguments() { var seriesSpy = new SeriesSpy(new[] { 8, 3, 0, 6, 6, 2, 3 }); var series = new Series <int>(seriesSpy.NextArgs, seriesSpy); for (var i = 0; i < 10; i += 1) { series.Next(); } Assert.True(seriesSpy.Verify()); }
public void Next_OneArgConstructor_FuncIsInvokedCorrectly() { var seriesSpy = new SeriesSpy(new[] { 1 }); Func <int[], int> spyFunc = seriesSpy; var func = new Func <int, int>(i => spyFunc.Invoke(new int[] { i })); var series = new Series <int>(seriesSpy.NextArgs[0], func); for (int i = 0; i < seriesSpy.NextArgs.Length * 2; i += 1) { series.Next(); } Assert.True(seriesSpy.Verify()); }
public void Next_TwoArgConstructor_FuncIsInvokedCorrectly() { var t = new[] { 0, 1 }; var seriesSpy = new SeriesSpy(t); Func <int[], int> spyFunc = seriesSpy; var func = new Func <int, int, int>((a, b) => spyFunc.Invoke(new int[] { a, b })); var series = new Series <int>(t[0], t[1], func); for (int i = 0; i < seriesSpy.NextArgs.Length * 2; i += 1) { series.Next(); } Assert.True(seriesSpy.Verify()); }