public void Sequence()
        {
            var ms = new[]
            {
                new[] {1, 2, 3}.AsEnumerable(),
                new[] {4, 5, 6}.AsEnumerable()
            }.AsEnumerable();

            var actual = ms.Sequence();

            var expected = new[]
            {
                new[] {1, 4}.AsEnumerable(),
                new[] {1, 5}.AsEnumerable(),
                new[] {1, 6}.AsEnumerable(),
                new[] {2, 4}.AsEnumerable(),
                new[] {2, 5}.AsEnumerable(),
                new[] {2, 6}.AsEnumerable(),
                new[] {3, 4}.AsEnumerable(),
                new[] {3, 5}.AsEnumerable(),
                new[] {3, 6}.AsEnumerable()
            }.AsEnumerable();

            Assert.That(actual, Is.EqualTo(expected));
        }
		public void SequenceTest()
		{
			var withNothing = new[] { Maybe.Just(1), Maybe.Nothing };
			var withoutNothing = new[] { Maybe.Just(1), Maybe.Just(2) };
			var emtpy = new Maybe<int>[0];

			AssertNothing(withNothing.Sequence());
			AssertSome(withoutNothing.Sequence(), new[] { 1, 2 });

			AssertSome(emtpy.Sequence(), new int[0]);
		}
Пример #3
0
        public void Sequence()
        {
            var ms = new[]
            {
                Task.Factory.StartNew(() => { Thread.Sleep(100); return 1; }),
                Task.Factory.StartNew(() => { Thread.Sleep(200); return 2; }),
                Task.Factory.StartNew(() => { Thread.Sleep(300); return 3; })
            };

            var actual = ms.Sequence();

            Assert.That(actual.Result, Is.EqualTo(new[] {1, 2, 3}));
        }