Exemplo n.º 1
0
        public void FailedIsTrueIfFutureValueIsException()
        {
            var f = new Future <object>();

            f.Fail(new Exception("test"));
            Assert.IsTrue(f.Failed);
        }
Exemplo n.º 2
0
        public void InvokesOnCompletesWhenFailed()
        {
            var    f = new Future <object>();
            object completeResult = null;

            f.RegisterOnComplete((_) => { completeResult = _.Error ?? _.Result; });
            f.Fail(new Exception("test"));
            Assert.AreEqual("test", (completeResult as Exception).Message);
        }
Exemplo n.º 3
0
        public void GettingResultThrowsExceptionIfFutureValueIsException()
        {
            var f = new Future <object>();

            f.Fail(new Exception("test"));
            try {
                var _ = f.Result;
                Assert.Fail();
            } catch (FutureException e) {
                Assert.AreEqual("test", e.InnerException.Message);
            }
        }
Exemplo n.º 4
0
 public override void Fail(Exception ex)
 {
     Future.Fail(ex);
 }