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); }
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")); }
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])); } }
public Subsystem <string> ErrorHappened() => from a in Subsystem.Fail <string>("error") select a;