private static void AssertSumWithIndex(int times, int expected) { var sum = 0; var indexes = new List <int>(); times.Times(index => { ++sum; indexes.Add(index); }); Assert.AreEqual(expected, sum); Assert.AreEqual(times < 0 ? 0 : times, indexes.Count); AssertIterator.IndexesGrow(0, indexes); }
private static void AssertEachWithIndex(string input) { var sb = new StringBuilder(); var indexes = new List <int>(); input.Each((ch, i) => { sb.Append(ch); indexes.Add(i); }); Assert.AreEqual(sb.ToString(), input); AssertIterator.IndexesGrow(0, indexes); }