mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 23:01:10 +00:00
Capitalizes the first word and adds the terminal period in the unit, integration and security tests. The AAA markers stay bare, the TODO bodies stay lowercase, and no assertion, payload, expected status code or test signature changes.
65 lines
2.3 KiB
C#
65 lines
2.3 KiB
C#
#region ========================================================================= USING =====================================================================================
|
|
using Lumina.Application.Common.Mapping.UsersManagement.Users;
|
|
using Lumina.Application.Core.UsersManagement.Settings.Commands.UpdatePlaybackState;
|
|
using Lumina.Contracts.Fixtures.Core.Requests.UsersManagement.Settings;
|
|
using Lumina.Contracts.Requests.UsersManagement.Settings;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
#endregion
|
|
|
|
namespace Lumina.Application.UnitTests.Common.Mapping.UsersManagement.Users;
|
|
|
|
/// <summary>
|
|
/// Contains unit tests for the <see cref="UpdatePlaybackStateRequestMapping"/> class.
|
|
/// </summary>
|
|
[ExcludeFromCodeCoverage]
|
|
public class UpdatePlaybackStateRequestMappingTests
|
|
{
|
|
private readonly UpdatePlaybackStateRequestFixture _updatePlaybackStateRequestFixture = new();
|
|
|
|
[Fact]
|
|
public void ToCommand_WhenMappingValidRequest_ShouldMapCorrectly()
|
|
{
|
|
// Arrange
|
|
UpdatePlaybackStateRequest request = _updatePlaybackStateRequestFixture.Create(volume: 0.35, isMuted: true);
|
|
|
|
// Act
|
|
UpdatePlaybackStateCommand result = request.ToCommand();
|
|
|
|
// Assert
|
|
Assert.NotNull(result);
|
|
Assert.Equal(0.35, result.Volume);
|
|
Assert.True(result.IsMuted);
|
|
}
|
|
|
|
[Fact]
|
|
public void ToCommand_WhenRequestHasNullValues_ShouldPreserveTheNulls()
|
|
{
|
|
// Arrange
|
|
UpdatePlaybackStateRequest request = _updatePlaybackStateRequestFixture.Create(includeVolume: false, includeIsMuted: false);
|
|
|
|
// Act
|
|
UpdatePlaybackStateCommand result = request.ToCommand();
|
|
|
|
// Assert
|
|
Assert.NotNull(result);
|
|
Assert.Null(result.Volume);
|
|
Assert.Null(result.IsMuted);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(0.0, false)] // The minimum volume, not muted.
|
|
[InlineData(1.0, true)] // The maximum volume, muted.
|
|
public void ToCommand_WhenMappingBoundaryValues_ShouldMapThemExactly(double volume, bool isMuted)
|
|
{
|
|
// Arrange
|
|
UpdatePlaybackStateRequest request = _updatePlaybackStateRequestFixture.Create(volume: volume, isMuted: isMuted);
|
|
|
|
// Act
|
|
UpdatePlaybackStateCommand result = request.ToCommand();
|
|
|
|
// Assert
|
|
Assert.Equal(volume, result.Volume);
|
|
Assert.Equal(isMuted, result.IsMuted);
|
|
}
|
|
}
|