Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }