Ejemplo n.º 1
0
        public void CallAsyncMethodsCorrectly2()
        {
            var hw       = new TestAsyncApp();
            var exitCode = Sidi.GetOpt.GetOpt.Run(hw, new[] { "TestAsyncWithStringResult" });

            Assert.IsTrue(hw.TestAsyncWasCalled);
            Assert.AreEqual(0, exitCode);
        }
Ejemplo n.º 2
0
 public void HandleExceptionsInAsyncMethodsCorrectly()
 {
     using (var c = new CaptureConsoleOutput())
     {
         var hw       = new TestAsyncApp();
         var exitCode = Sidi.GetOpt.GetOpt.Run(hw, new[] { "TestAsyncWithException" });
         Assert.IsTrue(hw.TestAsyncWasCalled);
         Assert.AreEqual(-1, exitCode);
         StringAssert.Contains(TestAsyncApp.anErrorOccured, c.error.ToString());
     }
 }
Ejemplo n.º 3
0
 public void CustomExceptionHandler()
 {
     using (var c = new CaptureConsoleOutput())
     {
         var hw = new TestAsyncApp();
         var go = new Sidi.GetOpt.GetOpt
         {
             Application = hw,
             Arguments   = new[] { "TestAsyncWithException" },
             OnException = (e) => - 123
         };
         var exitCode = go.Run();
         Assert.IsTrue(hw.TestAsyncWasCalled);
         Assert.AreEqual(-123, exitCode);
     }
 }