Skip to content

Commit

Permalink
Merge pull request #780 from tmenier/dev
Browse files Browse the repository at this point in the history
Flurl.Http.Newtonsoft take 2 (better test coverage)
  • Loading branch information
tmenier authored Dec 5, 2023
2 parents 73464bd + 54a461c commit 54dbf6e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
run: dotnet build -c Release --no-restore

- name: Test
run: dotnet test --no-build -c Release /p:CollectCoverage=true /p:Threshold=80 /p:Include=\"[Flurl]*,[Flurl.Http]*\" /p:Exclude="[*]*.GeneratedExtensions"
run: dotnet test --no-build -c Release /p:CollectCoverage=true /p:Threshold=80 /p:Include=\"[Flurl]*,[Flurl.Http]*,[Flurl.Http.Newtonsoft]*\" /p:Exclude="[*]*.GeneratedExtensions"
13 changes: 13 additions & 0 deletions test/Flurl.Test/Http/NewtonsoftTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ public async Task can_get_dynamic_list() {
Assert.AreEqual(2, data[1].id);
Assert.AreEqual("Claire", data[1].name);
}

[Test]
public async Task null_response_returns_null_dynamic() {
// a null IFlurlResponse is likely not even possible in real-world scenarios, but we have
// null checks that need to be tested in order to meet our coverage threshold for this lib.
Task<IFlurlResponse> resp = Task.FromResult<IFlurlResponse>(null);

var json = await resp.ReceiveJson();
Assert.IsNull(json);

var list = await resp.ReceiveJsonList();
Assert.IsNull(list);
}
}

[TestFixture, Parallelizable]
Expand Down

0 comments on commit 54dbf6e

Please sign in to comment.