feat(Tests.Client.BaseHttpClientServiceTests): Test für Abfrageparameter hinzugefügt

This commit is contained in:
Developer 02
2024-11-22 12:48:36 +01:00
parent b577067379
commit 4bb242a4cc
2 changed files with 25 additions and 2 deletions

View File

@@ -21,7 +21,7 @@ namespace DigitalData.Core.Tests.Client
}
[Test]
public async Task FetchJsonAsync_ShouldReturnJsonResponse()
public async Task FetchJsonAsync_ShouldReturnJsonResponse_WithCorrectWithPath()
{
// Act
var expectedUserId = (int) await _service.FetchAsync(path: "/1", sendWithCookie: false, saveCookie: false)
@@ -31,5 +31,22 @@ namespace DigitalData.Core.Tests.Client
// Assert
Assert.That(expectedUserId, Is.EqualTo(1), "The userId of the fetched JSON object should be 1.");
}
[Test]
public async Task FetchJsonAsync_ShouldReturnJsonResponse_WithQueryParams()
{
var queryParams = new Dictionary<string, string>
{
{ "userId", "1" }
};
// Act
var expectedUserId = (int)await _service.FetchAsync(queryParams: queryParams, sendWithCookie: false, saveCookie: false)
.ThenAsync(res => res.Json())
.ThenAsync(todo => todo.userId);
// Assert
Assert.That(expectedUserId, Is.EqualTo(1), "The userId of the fetched JSON object should be 1.");
}
}
}