|
|
|
@ -30,7 +30,7 @@ namespace Squidex.Write.Apps |
|
|
|
{ |
|
|
|
private readonly Mock<ClientKeyGenerator> keyGenerator = new Mock<ClientKeyGenerator>(); |
|
|
|
private readonly Mock<IAppRepository> appRepository = new Mock<IAppRepository>(); |
|
|
|
private readonly Mock<IAppPlansProvider> appLimitsProvider = new Mock<IAppPlansProvider>(); |
|
|
|
private readonly Mock<IAppPlansProvider> appPlansProvider = new Mock<IAppPlansProvider>(); |
|
|
|
private readonly Mock<IAppPlanBillingManager> appPlansBillingManager = new Mock<IAppPlanBillingManager>(); |
|
|
|
private readonly Mock<IUserResolver> userResolver = new Mock<IUserResolver>(); |
|
|
|
private readonly AppCommandHandler sut; |
|
|
|
@ -44,7 +44,7 @@ namespace Squidex.Write.Apps |
|
|
|
{ |
|
|
|
app = new AppDomainObject(AppId, -1); |
|
|
|
|
|
|
|
sut = new AppCommandHandler(Handler, appRepository.Object, appLimitsProvider.Object, appPlansBillingManager.Object, userResolver.Object, keyGenerator.Object); |
|
|
|
sut = new AppCommandHandler(Handler, appRepository.Object, appPlansProvider.Object, appPlansBillingManager.Object, userResolver.Object, keyGenerator.Object); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
@ -99,7 +99,7 @@ namespace Squidex.Write.Apps |
|
|
|
[Fact] |
|
|
|
public async Task AssignContributor_throw_exception_if_reached_max_contributor_size() |
|
|
|
{ |
|
|
|
appLimitsProvider.Setup(x => x.GetPlan(null)).Returns(new ConfigAppLimitsPlan { MaxContributors = 2 }); |
|
|
|
appPlansProvider.Setup(x => x.GetPlan(null)).Returns(new ConfigAppLimitsPlan { MaxContributors = 2 }); |
|
|
|
|
|
|
|
CreateApp() |
|
|
|
.AssignContributor(CreateCommand(new AssignContributor { ContributorId = "1" })) |
|
|
|
@ -133,7 +133,7 @@ namespace Squidex.Write.Apps |
|
|
|
[Fact] |
|
|
|
public async Task AssignContributor_should_assign_if_user_found() |
|
|
|
{ |
|
|
|
appLimitsProvider.Setup(x => x.GetPlan(null)).Returns(new ConfigAppLimitsPlan { MaxContributors = -1 }); |
|
|
|
appPlansProvider.Setup(x => x.GetPlan(null)).Returns(new ConfigAppLimitsPlan { MaxContributors = -1 }); |
|
|
|
|
|
|
|
CreateApp(); |
|
|
|
|
|
|
|
@ -185,7 +185,7 @@ namespace Squidex.Write.Apps |
|
|
|
[Fact] |
|
|
|
public async Task ChangePlan_should_throw_if_plan_not_found() |
|
|
|
{ |
|
|
|
appLimitsProvider.Setup(x => x.IsConfiguredPlan("my-plan")).Returns(false); |
|
|
|
appPlansProvider.Setup(x => x.IsConfiguredPlan("my-plan")).Returns(false); |
|
|
|
|
|
|
|
CreateApp() |
|
|
|
.AttachClient(CreateCommand(new AttachClient { Id = clientName }), clientSecret); |
|
|
|
@ -201,7 +201,7 @@ namespace Squidex.Write.Apps |
|
|
|
[Fact] |
|
|
|
public async Task ChangePlan_should_update_domain_object() |
|
|
|
{ |
|
|
|
appLimitsProvider.Setup(x => x.IsConfiguredPlan("my-plan")).Returns(true); |
|
|
|
appPlansProvider.Setup(x => x.IsConfiguredPlan("my-plan")).Returns(true); |
|
|
|
|
|
|
|
CreateApp() |
|
|
|
.AttachClient(CreateCommand(new AttachClient { Id = clientName }), clientSecret); |
|
|
|
|