1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

Resolve platform warnings (#5798)

* Installation Repository tests

* Formatting

* Remove extra LastActivityDate property

* Remove exclusion
This commit is contained in:
Justin Baur
2025-05-09 16:03:09 -04:00
committed by GitHub
parent 0075a15485
commit 15b498184f
4 changed files with 51 additions and 16 deletions

View File

@ -0,0 +1,46 @@
using Bit.Core.Platform.Installations;
using Bit.Infrastructure.IntegrationTest.Comparers;
using Xunit;
namespace Bit.Infrastructure.IntegrationTest.Platform.Installations;
public class InstallationRepositoryTests
{
[DatabaseTheory, DatabaseData]
public async Task GetByIdAsync_Works(IInstallationRepository installationRepository)
{
var installation = await installationRepository.CreateAsync(new Installation
{
Email = "test@email.com",
Key = "installation_key",
Enabled = true,
});
var retrievedInstallation = await installationRepository.GetByIdAsync(installation.Id);
Assert.NotNull(retrievedInstallation);
Assert.Equal("installation_key", retrievedInstallation.Key);
}
[DatabaseTheory, DatabaseData]
public async Task UpdateAsync_Works(IInstallationRepository installationRepository)
{
var installation = await installationRepository.CreateAsync(new Installation
{
Email = "test@email.com",
Key = "installation_key",
Enabled = true,
});
var now = DateTime.UtcNow;
installation.LastActivityDate = now;
await installationRepository.ReplaceAsync(installation);
var retrievedInstallation = await installationRepository.GetByIdAsync(installation.Id);
Assert.NotNull(retrievedInstallation.LastActivityDate);
Assert.Equal(now, retrievedInstallation.LastActivityDate.Value, LaxDateTimeComparer.Default);
}
}