The core infrastructure backend (API, database, Docker, etc).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

46 lines
1.5 KiB

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