Skip to content

Commit f0fb798

Browse files
Add async test case
Add test case to validate async templating of bundles.
1 parent 1b215e0 commit f0fb798

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tests/HttpClientInterception.Tests/Bundles/BundleExtensionsTests.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,30 @@ public static async Task Can_Intercept_Http_Requests_From_Bundle_File_With_Templ
225225
content.ShouldBe("<html><head><title>Just Eat</title></head></html>");
226226
}
227227

228+
[Fact]
229+
public static async Task Can_Intercept_Http_Requests_From_Bundle_File_With_Templated_String_With_User_Template_Values_Async()
230+
{
231+
// Arrange
232+
var options = new HttpClientInterceptorOptions().ThrowsOnMissingRegistration();
233+
234+
var headers = new Dictionary<string, string>()
235+
{
236+
["user-agent"] = "My-Other-App/1.0.0",
237+
};
238+
239+
var templateValues = new Dictionary<string, string>()
240+
{
241+
["ApplicationName"] = "My-Other-App",
242+
};
243+
244+
// Act
245+
await options.RegisterBundleAsync(Path.Join("Bundles", "templated-bundle-string.json"), templateValues);
246+
247+
// Assert
248+
string content = await HttpAssert.GetAsync(options, "https://www.just-eat.co.uk/", headers: headers);
249+
content.ShouldBe("<html><head><title>Just Eat</title></head></html>");
250+
}
251+
228252
[Fact]
229253
public static async Task Can_Intercept_Http_Requests_From_Bundle_File_With_Templated_Base64()
230254
{

0 commit comments

Comments
 (0)