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);
        }
Esempio n. 2
0
        internal static UnaryOperatorKind ToUnaryOperatorKind(this string operatorType)
        {
            switch (operatorType)
            {
            case "not":
                return(UnaryOperatorKind.Not);

            default:
                throw ODataException.BadRequest(ExceptionMessage.InvalidOperator(operatorType), "$filter");
            }
        }
Esempio n. 3
0
 internal static BinaryOperatorKind ToBinaryOperatorKind(this string operatorType)
 => s_operatorTypeMap.TryGetValue(operatorType, out BinaryOperatorKind binaryOperatorKind)
         ? binaryOperatorKind
         : throw ODataException.BadRequest(ExceptionMessage.InvalidOperator(operatorType), "$filter");