2025-11-17 15:46:02 -05:00
|
|
|
|
using Bit.Core.Entities;
|
|
|
|
|
|
using Bit.Core.KeyManagement.Queries;
|
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Test.KeyManagement.Queries;
|
|
|
|
|
|
|
|
|
|
|
|
public class GetMinimumClientVersionForUserQueryTests
|
|
|
|
|
|
{
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
public async Task Run_ReturnsMinVersion_ForV2User()
|
|
|
|
|
|
{
|
2025-12-03 09:46:00 -05:00
|
|
|
|
var sut = new GetMinimumClientVersionForUserQuery();
|
|
|
|
|
|
var version = await sut.Run(new User
|
|
|
|
|
|
{
|
|
|
|
|
|
SecurityVersion = 2
|
|
|
|
|
|
});
|
2025-12-02 13:46:23 -05:00
|
|
|
|
Assert.Equal(Core.KeyManagement.Constants.MinimumClientVersionForV2Encryption, version);
|
2025-11-17 15:46:02 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
public async Task Run_ReturnsNull_ForV1User()
|
|
|
|
|
|
{
|
2025-12-03 09:46:00 -05:00
|
|
|
|
var sut = new GetMinimumClientVersionForUserQuery();
|
|
|
|
|
|
var version = await sut.Run(new User
|
|
|
|
|
|
{
|
|
|
|
|
|
SecurityVersion = 1
|
|
|
|
|
|
});
|
2025-11-17 15:46:02 -05:00
|
|
|
|
Assert.Null(version);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|