public void BuildRuntimeExpressionThrowsInvalidFormat(string expression)
        {
            // Arrange & Act
            Action test = () => RuntimeExpression.Build(expression);

            // Assert
            OpenApiException exception = Assert.Throws <OpenApiException>(test);

            Assert.Equal(String.Format(SRResource.RuntimeExpressionHasInvalidFormat, expression), exception.Message);
        }
        public void BuildRuntimeExpressionThrowsWithDollarPrefix(string expression)
        {
            // Arrange & Act
            Action test = () => RuntimeExpression.Build(expression);

            // Assert
            OpenApiException exception = Assert.Throws <OpenApiException>(test);

            Assert.Equal(String.Format(SRResource.RuntimeExpressionMustBeginWithDollar, expression), exception.Message);
        }
Пример #3
0
        public void CreateAuthorizationThrowsForOAuthAuthorizationRecord()
        {
            // Arrange & Act
            IEdmStructuredTypeReference structuredTypeRef = GetType("Org.OData.Authorization.V1.OAuthAuthorization");
            IEdmRecordExpression        record            = new EdmRecordExpression(structuredTypeRef,
                                                                                    new EdmPropertyConstructor("Name", new EdmStringConstant("temp")));

            Action test = () => OData.Vocabulary.Authorization.Authorization.CreateAuthorization(record);

            // Assert
            OpenApiException exception = Assert.Throws <OpenApiException>(test);

            Assert.Equal(String.Format(SRResource.AuthorizationRecordTypeNameNotCorrect, structuredTypeRef.FullName()), exception.Message);
        }
Пример #4
0
 /// <summary>
 /// Initializes the <see cref="OpenApiError"/> class using the message and pointer from the given exception.
 /// </summary>
 public OpenApiError(OpenApiException exception) : this(exception.Pointer, exception.Message)
 {
 }
Пример #5
0
 /// <summary>
 /// Creates error object from thrown exception
 /// </summary>
 /// <param name="exception"></param>
 public OpenApiReaderError(OpenApiException exception) : base(exception)
 {
 }
 /// <summary>
 /// Initializes the <see cref="OpenApiError"/> class using the message and pointer from the given exception.
 /// </summary>
 public OpenApiReferenceError(OpenApiException exception) : base(exception.Pointer, exception.Message)
 {
 }
Пример #7
0
 /// <summary>
 /// Initializes the <see cref="OpenApiError"/> class using the message and pointer from the given exception.
 /// </summary>
 public OpenApiError(OpenApiException exception)
 {
     Message = exception.Message;
     Pointer = exception.Pointer;
 }