Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions Analysis.Build.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<AnalysisModeReliability>true</AnalysisModeReliability>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" PrivateAssets="All"/>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" PrivateAssets="All" Condition=" '$(TargetFrawework)' == 'netstandard2.0' "/>
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,6 @@
Pack="true" PackagePath="\" Visible="false" />
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)Analysis.Build.props" />

</Project>
1 change: 0 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
(conflicting with Workspaces.MSBuild 4.14.0). WolverineFx.EntityFrameworkCore
references this directly so the unification flows to all EF sample/test projects. -->
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3" />
<PackageVersion Include="Microsoft.Extensions.ApiDescription.Server" Version="9.0.5" />
<PackageVersion Include="Microsoft.FeatureManagement" Version="3.2.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@
<ProjectReference Include="..\..\Wolverine\Wolverine.csproj" />
</ItemGroup>

<Import Project="../../../Analysis.Build.props" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,5 @@
<PackageReference Include="FluentValidation" />
</ItemGroup>

<Import Project="../../../Analysis.Build.props" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@
<PackageReference Include="Newtonsoft.Json" />
</ItemGroup>

<Import Project="../../../Analysis.Build.props" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@
<PackageReference Include="Newtonsoft.Json" />
</ItemGroup>

<Import Project="../../../Analysis.Build.props" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async Task v1_orders_returns_v1_response()
x.StatusCodeShouldBeOk();
});

var response = result.ReadAsJson<OrdersV1Response>();
var response = await result.ReadAsJsonAsync<OrdersV1Response>();
response.ShouldNotBeNull();
response.Orders.ShouldContain("v1-order-1");
response.Orders.ShouldContain("v1-order-2");
Expand All @@ -38,7 +38,7 @@ public async Task v2_orders_returns_v2_response()
x.StatusCodeShouldBeOk();
});

var response = result.ReadAsJson<OrdersV2Response>();
var response = await result.ReadAsJsonAsync<OrdersV2Response>();
response.ShouldNotBeNull();
response.Status.ShouldBe("ok");
response.Items.ShouldContain("v2-a");
Expand Down Expand Up @@ -132,7 +132,7 @@ public async Task neutral_endpoint_keeps_its_declared_route()
x.StatusCodeShouldBeOk();
});

var response = result.ReadAsJson<HealthCheckResponse>();
var response = await result.ReadAsJsonAsync<HealthCheckResponse>();
response.ShouldNotBeNull();
response.Status.ShouldBe("ok");
}
Expand Down Expand Up @@ -163,7 +163,7 @@ public async Task neutral_endpoint_appears_in_default_swagger_doc()
x.StatusCodeShouldBeOk();
});

var body = result.ReadAsText();
var body = await result.ReadAsTextAsync();
body.ShouldContain("/health");
}

Expand All @@ -176,7 +176,7 @@ public async Task swagger_v1_doc_contains_orders_endpoint()
x.StatusCodeShouldBeOk();
});

var body = result.ReadAsText();
var body = await result.ReadAsTextAsync();
body.ShouldContain("/v1/orders");
}

Expand All @@ -189,7 +189,7 @@ public async Task swagger_default_doc_contains_all_orders_versions()
x.StatusCodeShouldBeOk();
});

var body = result.ReadAsText();
var body = await result.ReadAsTextAsync();
body.ShouldContain("/v1/orders");
body.ShouldContain("/v2/orders");
body.ShouldContain("/v3/orders");
Expand All @@ -205,7 +205,7 @@ public async Task swagger_v1_doc_marks_orders_deprecated()
x.StatusCodeShouldBeOk();
});

var body = result.ReadAsText();
var body = await result.ReadAsTextAsync();

// Parse JSON and navigate to the deprecated property
using var doc = JsonDocument.Parse(body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public async Task multi_version_endpoint_registers_v1_route()
x.StatusCodeShouldBeOk();
});

var response = result.ReadAsJson<CustomersResponse>();
var response = await result.ReadAsJsonAsync<CustomersResponse>();
response!.Names.ShouldContain("alice");
}

Expand All @@ -33,7 +33,7 @@ public async Task multi_version_endpoint_registers_v2_route()
x.StatusCodeShouldBeOk();
});

var response = result.ReadAsJson<CustomersResponse>();
var response = await result.ReadAsJsonAsync<CustomersResponse>();
response!.Names.ShouldContain("alice");
}

Expand All @@ -46,7 +46,7 @@ public async Task multi_version_endpoint_registers_v3_route()
x.StatusCodeShouldBeOk();
});

var response = result.ReadAsJson<CustomersResponse>();
var response = await result.ReadAsJsonAsync<CustomersResponse>();
response!.Names.ShouldContain("alice");
}

Expand Down Expand Up @@ -106,7 +106,7 @@ public async Task mapto_apiversion_registers_only_listed_version()
x.StatusCodeShouldBeOk();
});

var response = v2.ReadAsJson<CustomersResponse>();
var response = await v2.ReadAsJsonAsync<CustomersResponse>();
response!.Names.ShouldContain("v2-only-alice");

// v1 and v3 routes for this endpoint must not exist.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task does_support_multiple_nullable_query_parameters()
s.Get.Url("/nullable-query-parameters");
});

var response = result.ReadAsJson<NullableQueryParamsResult>();
var response = await result.ReadAsJsonAsync<NullableQueryParamsResult>();

response.ShouldBeEquivalentTo(
new NullableQueryParamsResult(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public async Task should_use_dotted_fromquery_name_for_string_parameters()
x.Get.Url("/querystring/dotted?hub.mode=subscribe&hub.challenge=abc123&hub.verify_token=mytoken");
});

body.ReadAsText().ShouldBe("subscribe|abc123|mytoken");
var text = await body.ReadAsTextAsync();
text.ShouldBe("subscribe|abc123|mytoken");
}

[Fact]
Expand All @@ -27,6 +28,7 @@ public async Task should_use_dotted_fromquery_name_for_int_parameter()
x.Get.Url("/querystring/dotted-int?page.number=42");
});

body.ReadAsText().ShouldBe("page 42");
var text = await body.ReadAsTextAsync();
text.ShouldBe("page 42");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public Bug_450_using_decimal_as_a_return_value(AppFixture fixture) : base(fixtur
public async Task get_the_decimal_body()
{
var body = await Scenario(x => x.Get.Url("/api/myapp/registration-price?numberOfMembers=100"));
var raw = body.ReadAsText();
var raw = await body.ReadAsTextAsync();
decimal.Parse(raw).ShouldBe(28000m);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public async Task run_end_to_end()

var body = await host.Scenario(x => x.Get.Url("/getusingfromqueryandaggregatehandler?id=" + aggregateId +"&something=Something2"));

body.ReadAsJson<FromQueryAggregateHandlerAggregate>().Something.ShouldBe("Something2");

var aggregate = await body.ReadAsJsonAsync<FromQueryAggregateHandlerAggregate>();
aggregate.Something.ShouldBe("Something2");
}
}

12 changes: 6 additions & 6 deletions src/Http/Wolverine.Http.Tests/Caching/OutputCacheTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ public async Task output_cached_endpoint_returns_same_response()
s.Get.Url("/api/cached");
s.StatusCodeShouldBeOk();
});
var firstBody = first.ReadAsText();
var firstBody = await first.ReadAsTextAsync();

// Second request should return cached response
var second = await Scenario(s =>
{
s.Get.Url("/api/cached");
s.StatusCodeShouldBeOk();
});
var secondBody = second.ReadAsText();
var secondBody = await second.ReadAsTextAsync();

// Should be the same cached response
secondBody.ShouldBe(firstBody);
Expand All @@ -40,14 +40,14 @@ public async Task non_cached_endpoint_returns_different_response()
s.Get.Url("/api/not-cached");
s.StatusCodeShouldBeOk();
});
var firstBody = first.ReadAsText();
var firstBody = await first.ReadAsTextAsync();

var second = await Scenario(s =>
{
s.Get.Url("/api/not-cached");
s.StatusCodeShouldBeOk();
});
var secondBody = second.ReadAsText();
var secondBody = await second.ReadAsTextAsync();

// Should be different responses
secondBody.ShouldNotBe(firstBody);
Expand All @@ -62,15 +62,15 @@ public async Task output_cached_default_endpoint_returns_same_response()
s.Get.Url("/api/cached-default");
s.StatusCodeShouldBeOk();
});
var firstBody = first.ReadAsText();
var firstBody = await first.ReadAsTextAsync();

// Second request should return cached response
var second = await Scenario(s =>
{
s.Get.Url("/api/cached-default");
s.StatusCodeShouldBeOk();
});
var secondBody = second.ReadAsText();
var secondBody = await second.ReadAsTextAsync();

// Should be the same cached response
secondBody.ShouldBe(firstBody);
Expand Down
12 changes: 6 additions & 6 deletions src/Http/Wolverine.Http.Tests/ContentNegotiationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task writes_text_plain_when_accept_header_matches()
x.StatusCodeShouldBeOk();
});

var text = result.ReadAsText();
var text = await result.ReadAsTextAsync();
text.ShouldBe("Widget: 42");
}

Expand All @@ -39,7 +39,7 @@ public async Task writes_csv_when_accept_header_matches()
x.StatusCodeShouldBeOk();
});

var text = result.ReadAsText();
var text = await result.ReadAsTextAsync();
text.ShouldBe("Name,Value\nWidget,42");
}

Expand All @@ -53,7 +53,7 @@ public async Task falls_back_to_json_in_loose_mode()
x.StatusCodeShouldBeOk();
});

var item = result.ReadAsJson<ConnegItem>();
var item = await result.ReadAsJsonAsync<ConnegItem>();
item.ShouldNotBeNull();
item!.Name.ShouldBe("Widget");
item.Value.ShouldBe(42);
Expand All @@ -69,7 +69,7 @@ public async Task falls_back_to_json_with_no_accept_header()
x.StatusCodeShouldBeOk();
});

var item = result.ReadAsJson<ConnegItem>();
var item = await result.ReadAsJsonAsync<ConnegItem>();
item.ShouldNotBeNull();
item!.Name.ShouldBe("LooseWidget");
}
Expand All @@ -95,7 +95,7 @@ public async Task strict_mode_returns_ok_when_match()
x.StatusCodeShouldBeOk();
});

var text = result.ReadAsText();
var text = await result.ReadAsTextAsync();
text.ShouldBe("StrictWidget: 99");
}

Expand All @@ -109,7 +109,7 @@ public async Task loose_mode_text_plain_works()
x.StatusCodeShouldBeOk();
});

var text = result.ReadAsText();
var text = await result.ReadAsTextAsync();
text.ShouldBe("LooseWidget: 77");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public async Task not_required_still_functions()
x.Get.Url("/letters2/" + Guid.NewGuid());
});

result.ReadAsText().ShouldBe("No Letters");
var text = await result.ReadAsTextAsync();
text.ShouldBe("No Letters");
}

[Fact]
Expand Down Expand Up @@ -99,7 +100,8 @@ public async Task not_required_still_functions_on_write()
x.Post.Url("/letters5/" + Guid.NewGuid());
});

result.ReadAsText().ShouldBe("No Letters");
var text = await result.ReadAsTextAsync();
text.ShouldBe("No Letters");
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ await Scenario(x =>
x.Get.Url("/frame-rearrange/" + invoice.Id);
});

var invoice2 = response.ReadAsJson<Invoice>();
var invoice2 = await response.ReadAsJsonAsync<Invoice>();
invoice2.Id.ShouldBe(invoice.Id);
}
}
4 changes: 2 additions & 2 deletions src/Http/Wolverine.Http.Tests/Marten/streaming_endpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public async Task stream_many_returns_empty_array_when_no_match_not_404()
x.ContentTypeShouldBe("application/json");
});

var body = result.ReadAsText();
var body = await result.ReadAsTextAsync();
body.Trim().ShouldBe("[]");
}

Expand All @@ -149,7 +149,7 @@ public async Task stream_aggregate_returns_latest_aggregate_as_json()
x.Post.Json(new StartOrder(["Socks", "Shoes"])).ToUrl("/orders/create");
});

var status = created.ReadAsJson<OrderStatus>();
var status = await created.ReadAsJsonAsync<OrderStatus>();

var body = await Host.GetAsJson<Order>($"/streaming/order/{status.OrderId}");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task use_read_aggregate_by_itself()
x.Get.Url("/sti/aggregate/" + streamId);
});

var aggregate = result.ReadAsJson<StrongLetterAggregate>();
var aggregate = await result.ReadAsJsonAsync<StrongLetterAggregate>();

aggregate.ACount.ShouldBe(1);
aggregate.BCount.ShouldBe(1);
Expand All @@ -52,8 +52,8 @@ await Scenario(x =>
x.Get.Url("/sti/aggregate/" + streamId);
});

var aggregate = result.ReadAsJson<StrongLetterAggregate>();
var aggregate = await result.ReadAsJsonAsync<StrongLetterAggregate>();

aggregate.ACount.ShouldBe(2);
aggregate.BCount.ShouldBe(1);
aggregate.CCount.ShouldBe(2);
Expand Down Expand Up @@ -125,7 +125,7 @@ public async Task use_entity_or_document_attribute()

var result = await Scenario(x => x.Get.Url("/toys/" + toy.Id.Value));

var thing2 = result.ReadAsJson<Toy>();
var thing2 = await result.ReadAsJsonAsync<Toy>();
thing2.Name.ShouldBe(toy.Name);
}
}
Loading
Loading