question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Core] Move Mocking Transport to Azure.Core

See original GitHub issue

API Change Needed

Yes

Background and motivation

Currently Azure.Core request, response, and transport are all very abstract. Implementing a simple “mocking” or a custom transport (e.g. a transport that injects faults) requires a lot of boilerplate code. It would be great to have some simple subtypes of Request, Response, and possibly the transport in Azure.Core.

We have such types in our testing framework, but they need to be cleaned up and the transport needs to be decoupled from recording framework.

API / Feature Proposal

namespace Azure.Core.Pipeline
{
    public class CoreResponse : Response
    {
    }
    public class CoreRequest : Request
    {
    }
}

Time Constraints and Dependencies

No deadline

Stakeholders

@annelo-msft

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
christothescommented, Oct 3, 2022

Wouldn’t users of the SDK just mock the client directly rather than getting involved with the implementation details of the transport?

1reaction
JoshLove-msftcommented, Sep 29, 2022

Mocking responses is discussed here - https://devblogs.microsoft.com/azure-sdk/unit-testing-and-mocking/#response. This can be done already using Moq.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source code for azure.core.pipeline.transport._base
Source code for azure.core.pipeline.transport. ... Union, Any, Mapping, Dict, Optional, Tuple, Iterator, ) from six.moves.http_client import HTTPConnection, ...
Read more >
How to Mock the File System for Unit Testing in .NET
In this article, we are going to learn how to mock the file system and unit test a component that interacts with the...
Read more >
Mocking azure file libraries for uploading a file from local to ...
I have a service class where I have a method implementing upload functionality to Azure file storage using Azure storage libraries such as ......
Read more >
Azure Service Bus client library for .NET
Use the client library for Azure Service Bus to: Transfer business data: leverage messaging for durable exchange of information, ...
Read more >
How To Simplify C# Unit Testing With a Mocking Framework
The quickest way to take your unit testing to the next level is with a mocking framework. Let's see how they work together....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found