Esempio n. 1
0
            public void Test_Verb()
            {
                Func <object, object, object> method = Operation switch {
                    Coercive.Operation.Plus => Coercively.Add,
                    Coercive.Operation.Minus => Coercively.Subtract,
                    Coercive.Operation.Times => Coercively.Multiply,
                    Coercive.Operation.DividedBy => Coercively.Divide,
                    _ => throw EnumUtils.InvalidEnumArgumentException(nameof(Operation), Operation)
                };

                AssertAll.Of(
                    $"Coercively.{Operation.Operator().Verb}()-ing [{AType.Name}]{A}, [{BType.Name}]{B}",
                    method.Invoke(A, B),
                    Is.EqualTo(E),
                    Is.TypeOf(EType)
                    );
            }
        }
Esempio n. 2
0
 public static object Compute(object a, Coercive.Operation operation, object b)
 {
     return(operation.Operator().Apply(a, b));
 }