Skip to content

Commit 6dfd3a7

Browse files
committed
Use XML to Linq
1 parent 8c6927c commit 6dfd3a7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Src/Support/IntegrationTests/ExternalAccountCredentialTests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ limitations under the License.
2222
using Google.Apis.Storage.v1.Data;
2323
using IntegrationTests.Utils;
2424
using System;
25+
using System.Linq;
2526
using System.Net.Http;
2627
using System.Threading.Tasks;
27-
using System.Xml;
28+
using System.Xml.Linq;
2829
using Xunit;
2930

3031
namespace IntegrationTests
@@ -76,8 +77,7 @@ public async Task AwsCredentials()
7677
HttpResponseMessage response = await httpClient.GetAsync(assumeRoleUrl);
7778
content = await response.Content.ReadAsStringAsync();
7879
}
79-
XmlDocument awsCredentialXml = new XmlDocument();
80-
awsCredentialXml.LoadXml(content);
80+
XElement awsCredentialXml = XElement.Parse(content);
8181

8282
// We store AWS credentials in environment variables to mimic an AWS environment.
8383
Environment.SetEnvironmentVariable("AWS_ACCESS_KEY_ID", AwsCredentialValue("AccessKeyId"));
@@ -109,7 +109,8 @@ public async Task AwsCredentials()
109109
// A final sanity-check.
110110
Assert.NotNull(buckets.Items);
111111

112-
string AwsCredentialValue(string tagName) => awsCredentialXml.GetElementsByTagName(tagName)[0].InnerText;
112+
string AwsCredentialValue(string tagName) =>
113+
awsCredentialXml.Descendants().Where(element => element.Name.LocalName == tagName).Single().Value;
113114
}
114115
}
115116
}

0 commit comments

Comments
 (0)