Exemple #1
0
        public void Select()
        {
            var set = Enumerate.Return(1).Select(t => t + 1)();

            Assert.AreEqual(2, set().Value);
            Assert.IsFalse(set().HasValue);
        }
Exemple #2
0
        public void Return()
        {
            var set = Enumerate.Return(1)();

            Assert.AreEqual(1, set().Value);
            Assert.IsFalse(set().HasValue);
        }
Exemple #3
0
        public void ToEnumerable()
        {
            var set = Enumerate.Return(1).ToEnumerable();

            Assert.AreEqual(1, set.Single());
        }
Exemple #4
0
        public void ThrowSelectMany()
        {
            var set = Enumerate.Throw <int>(new InvalidOperationException("Epic Fail!")).SelectMany(t => Enumerate.Return(1))();

            try
            {
                var v = set().Value;
                Assert.Fail("No exception thrown");
            }
            catch (InvalidOperationException)
            {
                // Expected
            }
        }