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.
 
 
 
 
 
 

27 lines
980 B

using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.OrganizationFeatures.OrganizationApiKeys;
using Bit.Core.Repositories;
using Bit.Test.Common.AutoFixture;
using Bit.Test.Common.AutoFixture.Attributes;
using NSubstitute;
using NSubstitute.ReceivedExtensions;
using Xunit;
namespace Bit.Core.Test.OrganizationFeatures.OrganizationApiKeys;
[SutProviderCustomize]
public class CreateOrganizationApiKeyCommandTest
{
[Theory]
[BitAutoData]
public async Task CreateAsync_CreatesOrganizationApiKey(SutProvider<CreateOrganizationApiKeyCommand> sutProvider,
Guid organizationId, OrganizationApiKeyType keyType)
{
await sutProvider.Sut.CreateAsync(organizationId, keyType);
await sutProvider.GetDependency<IOrganizationApiKeyRepository>().Received(1)
.CreateAsync(Arg.Is<OrganizationApiKey>(o => o.OrganizationId == organizationId
&& o.Type == keyType));
}
}