Microsoft.Ccr.Core.MultipleItemReceiverTest.Execute3 C# (CSharp) Method

Execute3() private method

private Execute3 ( ) : void
return void
        public void Execute3()
        {
            int cnt = 0;
            IPortReceive pa = new Port <int> ();
            IPortReceive pb = new Port <string> ();
            ITask task = new Task<int, string> ( (i, s) => { cnt += i + s.Length; });
            var mr = new MultipleItemReceiver (task, pa, pb);
            var dq = new SerialDispatchQueue ();
            mr.TaskQueue = dq;

            mr.Execute ();

            var a = (Port<int>)pa;
            var b = (Port<string>)pb;

            b.Post ("hello");
            Assert.AreEqual (0, cnt, "#1");
            a.Post (10);

            Assert.AreEqual (15, cnt, "#2");
        }