Beispiel #1
0
        public void CanBindFutureToOtherFuture()
        {
            var a = new Future <object>();
            var b = new Future <object>();

            b.Bind(a);
            a.Complete(5);
            Assert.AreEqual(5, b.Result);
        }
Beispiel #2
0
        public void BindToProperty()
        {
            var tc = new TestClass();
            var ts = new TestStruct();

            var f = new Future <int>();

            f.Bind(() => tc.Property);

            try {
                f.Bind(() => ts.Property);
                Assert.Fail("Did not throw InvalidOperationException");
            } catch (InvalidOperationException) {
            }

            f.Complete(5);

            Assert.AreEqual(5, tc.Property);
            Assert.AreNotEqual(5, ts.Property);
        }