Exemple #1
0
        public void AsyncOperationCreationSuccess()
        {
            var task = Operation.Run(async() =>
            {
                await Task.Run(() => Console.WriteLine("Hello Operation"));
            });

            task.Wait();

            Assert.IsTrue(task.Result.Succeeded);
        }
Exemple #2
0
        public void AsyncOperationCreationFailure()
        {
            var task = Operation.Run(async() =>
            {
                await Task.Run(() => Console.WriteLine("Hello Operation"));
                throw new Exception("The Error");
            });

            task.Wait();

            Assert.IsFalse(task.Result.Succeeded);
            Assert.AreEqual(task.Result.Message, "The Error");
        }
Exemple #3
0
 public void RunAsync(IEnumerable<Action> enumerable)
 {
     Operation operation = new Operation(enumerable, context);
     operation.Run();
 }