Skip to content

Commit

Permalink
fix unit-tests after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
ntruchsess committed Jun 14, 2023
1 parent c2ced8c commit 0b5327b
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,17 @@ private void SetupDeleteOwnCompanyServiceAccount(bool withServiceAccount, bool w
{
A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(ValidServiceAccountId, _identity.CompanyId))
.Returns((_userRoleIds, withServiceAccount ? ValidConnectorId : null, withClient ? ClientId : null, statusId: ConnectorStatusId.INACTIVE));
A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(A<Guid>.That.Not.Matches(x => x == ValidServiceAccountId), _identity.CompanyId))
.Returns(((IEnumerable<Guid>, Guid?, string?, ConnectorStatusId))default);
A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(A<Guid>.That.Not.Matches(x => x == ValidServiceAccountId), A<Guid>._))
.Returns(((IEnumerable<Guid>, Guid?, string?, ConnectorStatusId?))default);

if (identity != null)
{
A.CallTo(() => _userRepository.AttachAndModifyIdentity(ValidServiceAccountId, null, A<Action<Identity>>._))
.Invokes((Guid _, Action<Identity>? _, Action<Identity> modify) =>
{
modify.Invoke(identity);
});
}

if (companyServiceAccount != null)
{
Expand All @@ -590,14 +599,16 @@ private void SetupDeleteOwnCompanyServiceAccount(bool withServiceAccount, bool w

A.CallTo(() => _portalRepositories.GetInstance<IServiceAccountRepository>()).Returns(_serviceAccountRepository);
A.CallTo(() => _portalRepositories.GetInstance<IConnectorsRepository>()).Returns(_connectorsRepository);
A.CallTo(() => _portalRepositories.GetInstance<IUserRepository>()).Returns(_userRepository);
A.CallTo(() => _portalRepositories.GetInstance<IUserRolesRepository>()).Returns(_userRolesRepository);
}

private void SetupDeleteOwnCompanyServiceAccountForInvalidConnectorStatus(bool withServiceAccount, bool withClient, Connector? connector = null, Identity? identity = null, CompanyServiceAccount? companyServiceAccount = null)
{
A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(ValidServiceAccountId, _identity.CompanyId))
.Returns((_userRoleIds, withServiceAccount ? ValidConnectorId : null, withClient ? ClientId : null, statusId: ConnectorStatusId.ACTIVE));
A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(A<Guid>.That.Not.Matches(x => x == ValidServiceAccountId), _identity.CompanyId))
.Returns(((IEnumerable<Guid>, Guid?, string?, ConnectorStatusId))default);
A.CallTo(() => _serviceAccountRepository.GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(A<Guid>.That.Not.Matches(x => x == ValidServiceAccountId), A<Guid>._))
.Returns(((IEnumerable<Guid>, Guid?, string?, ConnectorStatusId?))default);

if (identity != null)
{
Expand Down

0 comments on commit 0b5327b

Please sign in to comment.