Esempio n. 1
0
        public void IntFailureThroughPromiseFlatMap()
        {
            bool called = false;

            m_promise.FulfillError(new Exception());

            m_future = m_future.FlatMap((i) => Future.Success(i));
            m_future.Recover((e) => { called = true; });

            Assert.That(called);
        }
Esempio n. 2
0
        public void IntFutureToUnitFlatMapRecover()
        {
            bool called = false;

            IFuture <int> success = Future.Success(32);

            success.FlatMap((x) => { throw new Exception(); return(Future.Success(99.0f)); }).Map((x) => {}).Recover((e) => { called = true; });

            Assert.That(called);
        }
Esempio n. 3
0
        public void IntFutureToFloatFlatMap()
        {
            float ret = -1;

            IFuture <int> success = Future.Success(32);

            success.FlatMap((x) => Future.Success(99.0f)).Map((x) => ret = x);

            Assert.AreEqual(99.0f, ret, 0.1f);
        }