Exemple #1
0
        public void TestConcat()
        {
            var p1 = Process.Emit(1);
            var p2 = Process.Emit(2);
            var p3 = p1.Concat(() => p2);

            p3.RunLog().ToList().ForEach(Console.WriteLine);
        }
Exemple #2
0
        public void TestProcess()
        {
            var expected = new[] { 1, 2, 3, 4, 5 };
            var p1       = Process.Apply(1, 2, 3, 4, 5);
            var result   = p1.RunLog();

            Assert.IsTrue(TestUtils.AreEqual(expected, result));
        }
Exemple #3
0
        public void TestSelectMany()
        {
            var p1      = Process.Apply(1);
            var p2      = Process.Apply(2);
            var p3      = p1.SelectMany(n => p2);
            var results = p3.RunLog();

            results.ForEach(Console.WriteLine);
        }
Exemple #4
0
        public void TestTee()
        {
            var p1 = Process.Apply(1, 2, 3, 4, 5).Select(n => n.ToString());
            var p2 = Process.Apply("a", "b", "c", "d", "e");
            var p3 = Process.Interleave(p1, p2);
            var p4 = Process.Sink <string>(s => Console.WriteLine(s));

            var results = p3.Pipe(p4).Run();
        }
Exemple #5
0
        public void TestSink()
        {
            var p1 = Process.Apply(1, 2, 3, 4, 5);
            var p2 = Process.Lift1 <int, Unit>(n => { Console.WriteLine(n); return(Unit.Only); });
            var p3 = p2.Concat(() => p2);
            var p4 = p1.Pipe(p3);

            p4.Run();
        }
Exemple #6
0
        public void TestWye()
        {
            var stopAfter30 = Process.Delay(3000);
            var count       = DelayCount(1);
            var combined    = Process.Wye(count, stopAfter30);
            var sink        = Process.Sink <IEither <int, Unit> >(either => Console.WriteLine(either));
            var result      = combined.Pipe(sink);

            result.Run();
        }