public void Count() { var chan = new Chan<int>(); chan .Send(Enumerable.Range(0, 10)) .ContinueWith(t => chan.Close()); var counting = chan.Count(); if (!counting.Wait(TimeSpan.FromSeconds(10))) { Assert.Fail(); } Assert.AreEqual(10, counting.Result); }