Exemplo n.º 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));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Starts a Cond with the given condition.
 /// </summary>
 public static ICondIf <TResult> If <TResult>(bool condition) => Cond <TResult> .If(condition);
Exemplo n.º 3
0
 /// <summary>
 /// Starts a Cond with the given condition.
 /// </summary>
 public static ICondIf <TResult> If <TResult>(Func <bool> condition) => Cond <TResult> .If(condition);
Exemplo n.º 4
0
 /// <summary>
 /// Starts a Cond with the given condition.
 /// </summary>
 public static ICondInitial If(bool condition) => Cond.If(condition);
Exemplo n.º 5
0
 /// <summary>
 /// Starts a Cond with the given condition.
 /// </summary>
 public static ICondInitial If(Func <bool> condition) => Cond.If(condition);
Exemplo n.º 6
0
 public void ExplicitResultOnCondClassName()
 {
     Assert.AreEqual(0, Cond <int> .If(() => true).Then(() => 0).Else(() => 1));
 }
Exemplo n.º 7
0
 public void ExplicitResultOnFirstCondition()
 {
     Assert.AreEqual(0, Cond.If <int>(() => true).Then(() => 0).Else(() => 1));
 }
Exemplo n.º 8
0
 public void InferResultTypeFromFirstConsequent()
 {
     Assert.AreEqual(0, Cond.If(() => true).Then(() => 0).Else(() => 1));
 }