mirror of
https://github.com/bitwarden/server.git
synced 2026-01-31 22:23:18 +08:00
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
|
|
using Bit.Core.Utilities;
|
|||
|
|
using Bit.Test.Common.AutoFixture.Attributes;
|
|||
|
|
using Xunit;
|
|||
|
|
|
|||
|
|
namespace Bit.Core.Test.Utilities;
|
|||
|
|
|
|||
|
|
public class EventIntegrationsCacheConstantsTests
|
|||
|
|
{
|
|||
|
|
[Theory, BitAutoData]
|
|||
|
|
public void BuildCacheKeyForGroup_ReturnsExpectedKey(Guid groupId)
|
|||
|
|
{
|
|||
|
|
var expected = $"Group:{groupId:N}";
|
|||
|
|
var key = EventIntegrationsCacheConstants.BuildCacheKeyForGroup(groupId);
|
|||
|
|
|
|||
|
|
Assert.Equal(expected, key);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[Theory, BitAutoData]
|
|||
|
|
public void BuildCacheKeyForOrganization_ReturnsExpectedKey(Guid orgId)
|
|||
|
|
{
|
|||
|
|
var expected = $"Organization:{orgId:N}";
|
|||
|
|
var key = EventIntegrationsCacheConstants.BuildCacheKeyForOrganization(orgId);
|
|||
|
|
|
|||
|
|
Assert.Equal(expected, key);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[Theory, BitAutoData]
|
|||
|
|
public void BuildCacheKeyForOrganizationUser_ReturnsExpectedKey(Guid orgId, Guid userId)
|
|||
|
|
{
|
|||
|
|
var expected = $"OrganizationUserUserDetails:{orgId:N}:{userId:N}";
|
|||
|
|
var key = EventIntegrationsCacheConstants.BuildCacheKeyForOrganizationUser(orgId, userId);
|
|||
|
|
|
|||
|
|
Assert.Equal(expected, key);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[Fact]
|
|||
|
|
public void CacheName_ReturnsExpected()
|
|||
|
|
{
|
|||
|
|
Assert.Equal("EventIntegrations", EventIntegrationsCacheConstants.CacheName);
|
|||
|
|
}
|
|||
|
|
}
|