DocSpace-client/thirdparty/onedrive-sdk-csharp-master/tests/Test.OneDriveSdk/Mocks/ExceptionHttpMessageHandler.cs
2020-07-10 18:37:02 +03:00

27 lines
921 B
C#

// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
namespace Test.OneDrive.Sdk.Mocks
{
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
public class ExceptionHttpMessageHandler : HttpMessageHandler
{
private Exception exceptionToThrow;
public ExceptionHttpMessageHandler(Exception exceptionToThrow)
{
this.exceptionToThrow = exceptionToThrow;
}
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
throw exceptionToThrow;
}
}
}