public void ToBinaryOperatorKind_Throws_ODataException_For_UnsupportedOperatorKind() { ODataException odataException = Assert.Throws <ODataException>(() => "wibble".ToBinaryOperatorKind()); Assert.Equal(ExceptionMessage.InvalidOperator("wibble"), odataException.Message); Assert.Equal(HttpStatusCode.BadRequest, odataException.StatusCode); Assert.Equal("$filter", odataException.Target); }
internal static UnaryOperatorKind ToUnaryOperatorKind(this string operatorType) { switch (operatorType) { case "not": return(UnaryOperatorKind.Not); default: throw ODataException.BadRequest(ExceptionMessage.InvalidOperator(operatorType), "$filter"); } }
internal static BinaryOperatorKind ToBinaryOperatorKind(this string operatorType) => s_operatorTypeMap.TryGetValue(operatorType, out BinaryOperatorKind binaryOperatorKind) ? binaryOperatorKind : throw ODataException.BadRequest(ExceptionMessage.InvalidOperator(operatorType), "$filter");