/// <summary> /// Creates an ExpectedException for ODataErrorException typed exceptions. /// </summary> /// <param name="expectedODataError">The expected value of the exception's Error property.</param> /// <param name="resourceKey">The resource key to look up the expected message.</param> /// <param name="messageArguments">Arguments for the expected exception message.</param> /// <returns>An ExpectedException for this expected ODataException.</returns> public static ExpectedException ODataErrorException(ODataError expectedODataError, string resourceKey, params string[] messageArguments) { var expectedException = new ExpectedException(typeof(ODataErrorException), GetResourceVerifier(DataFxAssemblyRef.OData).CreateExpectedError(resourceKey, messageArguments)); expectedException.CustomVerification = (e) => { if (!ODataObjectModelValidationUtils.AreEqual(expectedODataError, ((ODataErrorException)e).Error)) { throw new DataComparisonException("Expected ODataError instances to be equal."); } }; return(expectedException); }
/// <summary> /// Creates an ExpectedException for ODataErrorException typed exceptions. /// </summary> /// <param name="expectedODataError">The expected value of the exception's Error property.</param> /// <returns>An ExpectedException for this expected ODataException.</returns> public static ExpectedException ODataErrorException(ODataError expectedODataError) { var expectedException = new ExpectedException(typeof(ODataErrorException)); expectedException.CustomVerification = (e) => { if (!ODataObjectModelValidationUtils.AreEqual(expectedODataError, ((ODataErrorException)e).Error)) { throw new DataComparisonException("Expected ODataError instances to be equal."); } }; return(expectedException); }