#region ========================================================================= USING ===================================================================================== using Lumina.Contracts.Requests.MediaLibrary.Management; using System; using System.Diagnostics.CodeAnalysis; using System.Text.Json; #endregion namespace Lumina.Contracts.UnitTests.Requests.MediaLibrary.Management; /// /// Contains unit tests for the record. /// [ExcludeFromCodeCoverage] public class GetLibraryScanProgressRequestTests { private readonly JsonSerializerOptions _jsonOptions = new() { PropertyNameCaseInsensitive = true }; [Fact] public void RoundTrip_WhenSerializingGetLibraryScanProgressRequest_ShouldPreserveValues() { // Arrange Guid libraryId = Guid.NewGuid(); Guid scanId = Guid.NewGuid(); GetLibraryScanProgressRequest expected = new(libraryId, scanId); // Act string json = JsonSerializer.Serialize(expected, _jsonOptions); GetLibraryScanProgressRequest? actual = JsonSerializer.Deserialize(json, _jsonOptions); // Assert Assert.NotNull(actual); Assert.Equal(expected, actual); } [Fact] public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual() { // Arrange Guid libraryId = Guid.NewGuid(); Guid scanId = Guid.NewGuid(); GetLibraryScanProgressRequest first = new(libraryId, scanId); GetLibraryScanProgressRequest second = new(libraryId, scanId); // Act bool areEqual = first == second; // Assert Assert.True(areEqual); } }