Beispiel #1
0
 public void AbsorbtionAddsAllClauses()
 {
     Assert.AreEqual(
         3,
         Cond.If(false).Then(0)
         .If(false).Then(1)
         .Absorb(
             Cond.If(false).Then(2)
             .If(true).Then(3)
             .If(false).Then(4))
         .If(false).Then(5)
         .Else(-1));
 }
 /// <summary>
 /// Starts a Cond with the given condition.
 /// </summary>
 public static ICondIf <TResult> If <TResult>(bool condition) => Cond <TResult> .If(condition);
 /// <summary>
 /// Starts a Cond with the given condition.
 /// </summary>
 public static ICondIf <TResult> If <TResult>(Func <bool> condition) => Cond <TResult> .If(condition);
 /// <summary>
 /// Starts a Cond with the given condition.
 /// </summary>
 public static ICondInitial If(bool condition) => Cond.If(condition);
 /// <summary>
 /// Starts a Cond with the given condition.
 /// </summary>
 public static ICondInitial If(Func <bool> condition) => Cond.If(condition);
Beispiel #6
0
 public void ExplicitResultOnCondClassName()
 {
     Assert.AreEqual(0, Cond <int> .If(() => true).Then(() => 0).Else(() => 1));
 }
Beispiel #7
0
 public void ExplicitResultOnFirstCondition()
 {
     Assert.AreEqual(0, Cond.If <int>(() => true).Then(() => 0).Else(() => 1));
 }
Beispiel #8
0
 public void InferResultTypeFromFirstConsequent()
 {
     Assert.AreEqual(0, Cond.If(() => true).Then(() => 0).Else(() => 1));
 }