public int Hyperlinq_Create() { var sum = 0; foreach (var item in ValueEnumerable.Create <Enumerator, int>(() => new Enumerator(1, Count))) { sum += item; } return(sum); }
public void Value1() { var enumerable = ValueEnumerable.Create(5); Assert.AreEqual(1, enumerable.Count); Assert.AreEqual(5, enumerable[0]); Assert.AreEqual(1, enumerable.Count()); Assert.AreEqual(5, enumerable.Single()); }
public void Value2() { var enumerable = ValueEnumerable.Create(5, 7); Assert.AreEqual(2, enumerable.Count); Assert.AreEqual(5, enumerable[0]); Assert.AreEqual(7, enumerable[1]); Assert.AreEqual(2, enumerable.Count()); Assert.AreEqual(5, enumerable.First()); Assert.AreEqual(7, enumerable.Last()); }