using Bit.Api.Billing.Controllers; using Bit.Core; using Bit.Core.AdminConsole.Entities.Provider; using Bit.Core.AdminConsole.Enums.Provider; using Bit.Core.AdminConsole.Repositories; using Bit.Core.Context; using Bit.Core.Services; using Bit.Test.Common.AutoFixture; using NSubstitute; namespace Bit.Api.Test.Billing; public static class Utilities { public static void ConfigureStableAdminInputs( Provider provider, SutProvider sutProvider) where T : BaseProviderController { ConfigureBaseInputs(provider, sutProvider); sutProvider.GetDependency().ProviderProviderAdmin(provider.Id) .Returns(true); } public static void ConfigureStableServiceUserInputs( Provider provider, SutProvider sutProvider) where T : BaseProviderController { ConfigureBaseInputs(provider, sutProvider); sutProvider.GetDependency().ProviderUser(provider.Id) .Returns(true); } private static void ConfigureBaseInputs( Provider provider, SutProvider sutProvider) where T : BaseProviderController { sutProvider.GetDependency().IsEnabled(FeatureFlagKeys.EnableConsolidatedBilling) .Returns(true); provider.Type = ProviderType.Msp; provider.Status = ProviderStatusType.Billable; sutProvider.GetDependency().GetByIdAsync(provider.Id).Returns(provider); } }