public void TestGetResult()
        {
            var future = new SettableFuture <string>();

            Task.Factory.StartNew(() => future.Result = "done");
            Assert.AreEqual("done", future.GetResult(100));
        }
        public void TestGetResult_WhenException()
        {
            var future = new SettableFuture<string>();

            Task.Factory.StartNew(() => future.Exception = new Exception("Failed"));
            Assert.AreEqual("done", future.GetResult(100));
        }
        public void TestGetResult()
        {
            var future = new SettableFuture<string>();

            Task.Factory.StartNew(() => future.Result = "done");
            Assert.AreEqual("done", future.GetResult(100));
        }
Esempio n. 4
0
        public void TestGetResult_WhenException()
        {
            var future = new SettableFuture <string>();

            Task.Factory.StartNew(() => future.Exception = new Exception("Failed"));
            Assert.AreEqual("done", future.GetResult(100));
        }
        public void TestGetResult_WhenResultNotSet()
        {
            Assert.Throws <TimeoutException>(() =>
            {
                var future = new SettableFuture <string>();

                Assert.AreEqual("done", future.GetResult(100));
            });
        }
        public void TestCompleted_checkResult()
        {
            var future = new SettableFuture <string>();

            Task.Factory.StartNew(() => future.Exception = new Exception("Failed"));
            try
            {
                future.GetResult(100);
            }
            catch (Exception e)
            {
                Assert.AreEqual("Failed", e.Message);
            }

            Assert.NotNull(future.Exception);
            Assert.True(future.IsComplete);
        }
        public void TestCompleted_checkResult()
        {
            var future = new SettableFuture<string>();

            Task.Factory.StartNew(() => future.Exception = new Exception("Failed"));
            try
            {
                future.GetResult(100);
            }
            catch (Exception e)
            {
                Assert.AreEqual("Failed", e.Message);
            }

            Assert.NotNull(future.Exception);
            Assert.True(future.IsComplete);
        }
        public void TestGetResult_WhenResultNotSet()
        {
            var future = new SettableFuture<string>();

            Assert.AreEqual("done", future.GetResult(100));
        }
Esempio n. 9
0
        public void TestGetResult_WhenResultNotSet()
        {
            var future = new SettableFuture <string>();

            Assert.AreEqual("done", future.GetResult(100));
        }