コード例 #1
0
        public void Dispose()
        {
            var cref = this.Run(CloudValue.New(0, null, null));

            this.Run(cref.Dispose());
            Assert.Catch <Exception>(() => this.Run(cref.Value));
        }
コード例 #2
0
        public void TryFinally()
        {
            var cref = this.Run(CloudValue.New(0, null, null));

            var workflow = Cloud.New(() =>
                                     Cloud.TryFinally(
                                         Cloud.FromValue(42),
                                         Cloud.Dispose(cref)));
            var result = this.Run(workflow);

            Assert.AreEqual(42, result);

            //Assert.Catch<Exception>(() => this.Run(cref.Value));
            // Workaround because above lambda captures 'this'.
            try
            {
                this.Run(cref.Value);
                Assert.Fail();
            }
            catch
            {
                ; // Success
            }
        }