public static void AddRequestTimeoutResponseMessageMockHandler(this MockHttpManager httpManager, HttpMethod httpMethod) { httpManager.AddMockHandler( new MockHttpMessageHandler() { ExpectedMethod = httpMethod, ResponseMessage = MockHelpers.CreateRequestTimeoutResponseMessage(), ExceptionToThrow = new TaskCanceledException("request timed out") }); }