mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 12:11:10 +00:00
Caches JsonSerializerOptions instances in tests
This commit is contained in:
1 parent
c2e00242cc
commit
b2b6f554b7
3 files changed
+6
-8
No files matched your search
+2
-1
@@ -26,6 +26,7 @@ public class GetLibrariesEndpointTests
|
||||
private readonly IApiHttpClient _mockApiHttpClient;
|
||||
private readonly GetLibrariesEndpoint _sut;
|
||||
private readonly LibraryDtoFixture _libraryDtoFixture = new();
|
||||
private readonly JsonSerializerOptions _jsonOptions = new() { PropertyNameCaseInsensitive = true };
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetLibrariesEndpointTests"/> class.
|
||||
@@ -51,7 +52,7 @@ public class GetLibrariesEndpointTests
|
||||
// Assert
|
||||
using JsonDocument jsonDocument = JsonDocument.Parse(body);
|
||||
Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean());
|
||||
LibraryDto[]? returnedLibraries = jsonDocument.RootElement.GetProperty("data").Deserialize<LibraryDto[]>(new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||
LibraryDto[]? returnedLibraries = jsonDocument.RootElement.GetProperty("data").Deserialize<LibraryDto[]>(_jsonOptions);
|
||||
Assert.Equal(expectedLibraries.Select(library => library.Title), returnedLibraries!.Select(library => library.Title));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user