-
-
Save annelo-msft/49a46b21dd7213a2b33a458c7b2885af to your computer and use it in GitHub Desktop.
virtual_problem_uri.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AzureCorePolicy azureCorePolicy = new AzureCorePolicy(); | |
ClientModelPolicy clientModelPolicy = new ClientModelPolicy(); | |
MockRequest request = new MockRequest(); | |
request.Uri = new UriBuilder("www.example.com"); | |
azureCorePolicy.SetUri(request); | |
clientModelPolicy.UseUri(request); | |
public class PipelineRequest | |
{ | |
private Uri _uri; | |
public virtual Uri Uri | |
{ | |
get => UriCore; | |
set => UriCore = value; | |
} | |
protected virtual Uri UriCore | |
{ | |
get => _uri; | |
set => _uri = value; | |
} | |
} | |
public class Request : PipelineRequest | |
{ | |
private UriBuilder _uriBuilder; | |
public new virtual UriBuilder Uri | |
{ | |
get => _uriBuilder; | |
set => _uriBuilder = value; | |
} | |
protected override Uri UriCore | |
{ | |
get => Uri.Uri; | |
set => Uri = new UriBuilder(value); | |
} | |
} | |
public class MockRequest : Request | |
{ | |
private UriBuilder _uriBuilder; | |
public override UriBuilder Uri | |
{ | |
get => _uriBuilder; | |
set => _uriBuilder = value; | |
} | |
public void SetUri(UriBuilder value) => _uriBuilder = value; | |
} | |
public class AzureCorePolicy | |
{ | |
public void SetUri(MockRequest request) | |
{ | |
request.SetUri(new UriBuilder("www.azure-policy.com")); | |
Console.WriteLine($"AzureCorePolicy, Request.Uri: {request.Uri.Uri}"); | |
} | |
} | |
public class ClientModelPolicy | |
{ | |
public void UseUri(PipelineRequest request) | |
{ | |
Console.WriteLine($"ClientModelPolicy, Request.Uri: {request.Uri}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment