Esempio n. 1
0
        public void SubsystemTest3()
        {
            var expr = from a in Subsystem.Return <string>("Hello")
                       let c = fun(() => { throw new System.Exception(); })()
                               from b in Subsystem.Fail <string>("Error happend")
                               select a + c;

            var r = expr.Execute();

            r.Value.ShouldBe("");
            Assert.AreEqual(r.Value, "");
            Assert.AreEqual(r.IsFailed, true);
        }
Esempio n. 2
0
        public void SubsystemTest2()
        {
            B();
            System.Diagnostics.StackTrace t = new System.Diagnostics.StackTrace();

            var expr = from a in Subsystem.Return <string>("Hello")
                       let c = "Dummy"
                               from b in Subsystem.Fail <string>("Error happend")
                               select a + c;

            var r = expr.Execute();

            Assert.AreEqual(r.IsFailed, true);
            r.Error.IfSome(err => Assert.AreEqual(err.Message, "Error happend"));
        }
Esempio n. 3
0
 public Subsystem <string> FetchCommand(string[] args)
 {
     if (args.Count() == 0)
     {
         string message = "Usage: FilesUpgrad.exe <command>\n";
         message += "\n";
         message += "where <command> is :";
         message += "upgrade, copysetting";
         return(Subsystem.Fail <string>(message));
     }
     else
     {
         return(Subsystem.Return <string>(args[0]));
     }
 }
Esempio n. 4
0
 public Subsystem <string> ErrorHappened() =>
 from a in Subsystem.Fail <string>("error")
 select a;