1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-12 07:02:16 -05:00
Justin Baur 15b498184f
Resolve platform warnings (#5798)
* Installation Repository tests

* Formatting

* Remove extra LastActivityDate property

* Remove exclusion
2025-05-09 16:03:09 -04:00

47 lines
1.5 KiB
C#

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);
}
}