Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ResponseExtensions tests #22553

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
10f6ad0
Change the accessbility to virtual for Resource.Id
YalinLi0312 Mar 24, 2021
ccc17c7
merge from usptream
Apr 5, 2021
5060f5c
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash Apr 12, 2021
9a9a651
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash Apr 21, 2021
7764cb5
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 Apr 23, 2021
832483a
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 Apr 28, 2021
3066cd2
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 May 6, 2021
9597dc7
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 May 6, 2021
86547b0
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash May 10, 2021
4fa650c
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash May 10, 2021
6f858c5
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash May 17, 2021
fb80156
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash May 25, 2021
737171b
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash Jun 2, 2021
4f1408d
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 Jun 4, 2021
c5d5790
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash Jun 7, 2021
0bcb9e4
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 Jun 7, 2021
2a78d80
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 Jun 11, 2021
23eca40
Merge branch 'mgmt-track2' of https://github.com/AME-Redmond/azure-sd…
m-nash Jun 16, 2021
2bddb0e
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash Jun 16, 2021
1405a35
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 Jun 17, 2021
b874653
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 Jun 18, 2021
34eca7a
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 Jun 24, 2021
5720bdd
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 Jun 29, 2021
bdaa65a
WIP
YalinLi0312 Jun 30, 2021
9dd1525
Update a typo
YalinLi0312 Jul 9, 2021
46e5ba8
Update tests based on the typo
YalinLi0312 Jul 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static class ResponseExtensions
public static string GetCorrelationId(this Response response)
{
string correlationId = null;
response.Headers.TryGetValue("x-ms-correlation-id", out correlationId);
response.Headers.TryGetValue("x-ms-correlation-request-id", out correlationId);
return correlationId;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Core.TestFramework;
using NUnit.Framework;

namespace Azure.ResourceManager.Core.Tests
{
public class ResponseExtensionsTests : ResourceManagerTestBase
{
public ResponseExtensionsTests(bool isAsync)
: base(isAsync)//, RecordedTestMode.Record)
{
}

[TestCase]
[RecordedTest]
public async Task GetCorrelationId()
{
var correlationId = "0a98bb8b-ec3e-4f68-a8c1-a7705554a980";
var pipeline = Client.DefaultSubscription.Pipeline;
var endpoint = new Uri("https://management.azure.com");
var message = pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Get;
var uri = new RawRequestUriBuilder();
uri.Reset(endpoint);
uri.AppendPath("/subscriptions/", false);
uri.AppendPath(TestEnvironment.SubscriptionId, true);
uri.AppendQuery("api-version", "2019-11-01", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
request.Headers.Add("x-ms-correlation-request-id", correlationId);

await pipeline.SendAsync(message, default).ConfigureAwait(false);
var response = message.Response;
Assert.AreEqual(correlationId, ResponseExtensions.GetCorrelationId(response));
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.