public void Range() { var set = Enumerate.Range(2, 3)(); Assert.AreEqual(2, set().Value); Assert.AreEqual(3, set().Value); Assert.AreEqual(4, set().Value); Assert.IsFalse(set().HasValue); }
public void SelectMany() { var set = Enumerate.Range(0, 2).SelectMany(t => Enumerate.Range(0, 2))(); Assert.AreEqual(0, set().Value); Assert.AreEqual(1, set().Value); Assert.AreEqual(0, set().Value); Assert.AreEqual(1, set().Value); Assert.IsFalse(set().HasValue); }
public void LinqSelectMany() { var set = (from a in Enumerate.Range(0, 2) from b in Enumerate.Range(0, 2) select a + b)(); Assert.AreEqual(0, set().Value); Assert.AreEqual(1, set().Value); Assert.AreEqual(1, set().Value); Assert.AreEqual(2, set().Value); Assert.IsFalse(set().HasValue); }