Skip to content

Commit

Permalink
Reverting as it breaks the other .NET versions
Browse files Browse the repository at this point in the history
Signed-off-by: Whit Waldo <[email protected]>
  • Loading branch information
WhitWaldo committed Nov 26, 2024
1 parent 0189ffc commit 3635f5e
Showing 1 changed file with 18 additions and 37 deletions.
55 changes: 18 additions & 37 deletions test/Dapr.AspNetCore.IntegrationTest/CloudEventsIntegrationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,47 +143,28 @@ public async Task CanSendStructuredCloudEvent_WithNonJsonContentType()
[Fact]
public async Task CanSendBinaryCloudEvent_WithContentType()
{
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/register-user")
using (var factory = new AppWebApplicationFactory())
{
Content = new StringContent(
JsonSerializer.Serialize(
new
{
name = "jimmy",
}),
Encoding.UTF8)
};
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
var httpClient = factory.CreateClient(new Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactoryClientOptions { HandleCookies = false });

var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var userInfo = await JsonSerializer.DeserializeAsync<UserInfo>(await response.Content.ReadAsStreamAsync(), this.options);
userInfo.Name.Should().Be("jimmy");
var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/register-user")
{
Content = new StringContent(
JsonSerializer.Serialize(
new
{
name = "jimmy",
}),
Encoding.UTF8)
};
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();

Check failure on line 163 in test/Dapr.AspNetCore.IntegrationTest/CloudEventsIntegrationTest.cs

View workflow job for this annotation

GitHub Actions / Test .NET 9.0

Dapr.AspNetCore.IntegrationTest.CloudEventsIntegrationTest.CanSendBinaryCloudEvent_WithContentType: System.Net.Http.HttpRequestException : Response status code does not indicate success: 500 (Internal Server Error).

// using (var factory = new AppWebApplicationFactory())
// {
// var httpClient = factory.CreateClient(new Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactoryClientOptions { HandleCookies = false });
//
// var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/register-user")
// {
// Content = new StringContent(
// JsonSerializer.Serialize(
// new
// {
// name = "jimmy",
// }),
// Encoding.UTF8)
// };
// request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
//
// var response = await httpClient.SendAsync(request);
// response.EnsureSuccessStatusCode();
//
// var userInfo = await JsonSerializer.DeserializeAsync<UserInfo>(await response.Content.ReadAsStreamAsync(), this.options);
// userInfo.Name.Should().Be("jimmy");
// }
var userInfo = await JsonSerializer.DeserializeAsync<UserInfo>(await response.Content.ReadAsStreamAsync(), this.options);
userInfo.Name.Should().Be("jimmy");
}
}
}
}

0 comments on commit 3635f5e

Please sign in to comment.