private static IEnumerable<TypePromotionTestCase> ComputeUnaryErrorTestCases(UnaryOperatorKind operatorKind) { switch (operatorKind) { case UnaryOperatorKind.Negate: var negateCases = new[] { new { Operand = stringPropertyDescriptor }, new { Operand = boolPropertyDescriptor }, new { Operand = guidPropertyDescriptor }, new { Operand = binaryPropertyDescriptor }, }; return negateCases.SelectMany(c => ComputeUnaryErrorTestCases(c.Operand)); case UnaryOperatorKind.Not: var notCases = new[] { new { Operand = stringPropertyDescriptor }, new { Operand = guidPropertyDescriptor }, new { Operand = sbytePropertyDescriptor }, new { Operand = bytePropertyDescriptor }, new { Operand = int16PropertyDescriptor }, new { Operand = int32PropertyDescriptor }, new { Operand = int64PropertyDescriptor }, new { Operand = singlePropertyDescriptor }, new { Operand = doublePropertyDescriptor }, new { Operand = decimalPropertyDescriptor }, new { Operand = binaryPropertyDescriptor }, }; return notCases.SelectMany(c => ComputeUnaryErrorTestCases(c.Operand)); default: throw new NotSupportedException(); } }
private static IEnumerable<TypePromotionTestCase> ComputeArithmeticErrorTestCases() { var cases = new[] { new { First = decimalPropertyDescriptor, Second = singlePropertyDescriptor }, new { First = decimalPropertyDescriptor, Second = doublePropertyDescriptor }, }; // decimal to other type promotion return cases.SelectMany(c => ComputeBinaryErrorTestCases(c.First, c.Second)); }
private static IEnumerable<TypePromotionTestCase> ComputeRelationalErrorTestCases() { var cases = new[] { // string to other type promotion new { First = stringPropertyDescriptor, Second = boolPropertyDescriptor }, new { First = stringPropertyDescriptor, Second = sbytePropertyDescriptor }, new { First = stringPropertyDescriptor, Second = bytePropertyDescriptor }, new { First = stringPropertyDescriptor, Second = int16PropertyDescriptor }, new { First = stringPropertyDescriptor, Second = int32PropertyDescriptor }, new { First = stringPropertyDescriptor, Second = int64PropertyDescriptor }, new { First = stringPropertyDescriptor, Second = singlePropertyDescriptor }, new { First = stringPropertyDescriptor, Second = doublePropertyDescriptor }, new { First = stringPropertyDescriptor, Second = decimalPropertyDescriptor }, new { First = stringPropertyDescriptor, Second = guidPropertyDescriptor }, new { First = stringPropertyDescriptor, Second = binaryPropertyDescriptor }, // Guid to other type promotion new { First = guidPropertyDescriptor, Second = boolPropertyDescriptor }, new { First = guidPropertyDescriptor, Second = sbytePropertyDescriptor }, new { First = guidPropertyDescriptor, Second = bytePropertyDescriptor }, new { First = guidPropertyDescriptor, Second = int16PropertyDescriptor }, new { First = guidPropertyDescriptor, Second = int32PropertyDescriptor }, new { First = guidPropertyDescriptor, Second = int64PropertyDescriptor }, new { First = guidPropertyDescriptor, Second = singlePropertyDescriptor }, new { First = guidPropertyDescriptor, Second = doublePropertyDescriptor }, new { First = guidPropertyDescriptor, Second = decimalPropertyDescriptor }, new { First = guidPropertyDescriptor, Second = stringPropertyDescriptor }, new { First = guidPropertyDescriptor, Second = binaryPropertyDescriptor }, // Binary to other type promotion new { First = binaryPropertyDescriptor, Second = boolPropertyDescriptor }, new { First = binaryPropertyDescriptor, Second = sbytePropertyDescriptor }, new { First = binaryPropertyDescriptor, Second = bytePropertyDescriptor }, new { First = binaryPropertyDescriptor, Second = int16PropertyDescriptor }, new { First = binaryPropertyDescriptor, Second = int32PropertyDescriptor }, new { First = binaryPropertyDescriptor, Second = int64PropertyDescriptor }, new { First = binaryPropertyDescriptor, Second = singlePropertyDescriptor }, new { First = binaryPropertyDescriptor, Second = doublePropertyDescriptor }, new { First = binaryPropertyDescriptor, Second = decimalPropertyDescriptor }, new { First = binaryPropertyDescriptor, Second = stringPropertyDescriptor }, new { First = binaryPropertyDescriptor, Second = guidPropertyDescriptor }, // bool to other type promotion new { First = boolPropertyDescriptor, Second = sbytePropertyDescriptor }, new { First = boolPropertyDescriptor, Second = bytePropertyDescriptor }, new { First = boolPropertyDescriptor, Second = int16PropertyDescriptor }, new { First = boolPropertyDescriptor, Second = int32PropertyDescriptor }, new { First = boolPropertyDescriptor, Second = int64PropertyDescriptor }, new { First = boolPropertyDescriptor, Second = singlePropertyDescriptor }, new { First = boolPropertyDescriptor, Second = doublePropertyDescriptor }, new { First = boolPropertyDescriptor, Second = decimalPropertyDescriptor }, new { First = boolPropertyDescriptor, Second = stringPropertyDescriptor }, new { First = boolPropertyDescriptor, Second = binaryPropertyDescriptor }, new { First = boolPropertyDescriptor, Second = guidPropertyDescriptor }, // decimal to other type promotion new { First = decimalPropertyDescriptor, Second = boolPropertyDescriptor }, new { First = decimalPropertyDescriptor, Second = binaryPropertyDescriptor }, new { First = decimalPropertyDescriptor, Second = stringPropertyDescriptor }, new { First = decimalPropertyDescriptor, Second = guidPropertyDescriptor }, }; return ComputeArithmeticErrorTestCases() .Concat(cases.SelectMany(c => ComputeBinaryErrorTestCases(c.First, c.Second))); }
/// <summary> /// /// </summary> /// <param name="path"></param> /// <returns></returns> public virtual ODataPath HandleUnresolvedODataPath(Semantic.ODataPath path) { return null; }