mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
5a12db18d1
* Adding the Secret manager to the Plan List * Adding the unit test for the StaticStoreTests class * Fix whitespace formatting * Fix whitespace formatting * Price update * Resolving the PR comments * Resolving PR comments * Fixing the whitespace * only password manager plans are return for now * format whitespace * Resolve the test issue * Fixing the failing test * Refactoring the Plan separation * add a unit test for SingleOrDefault * Fix the whitespace format * Separate the PM and SM plans * Fixing the whitespace * Remove unnecessary directive * Fix imports ordering * Fix imports ordering * Resolve imports ordering * Fixing imports ordering * Fix response model, add MaxProjects * Fix filename * Fix format * Fix: seat price should match annual/monthly * Fix service account annual pricing * Name the sm service account planId properly * Update the secrets manager plan * correcting the wrong amount for the seats --------- Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
71 lines
2.3 KiB
C#
71 lines
2.3 KiB
C#
using Bit.Core.Enums;
|
|
using Bit.Core.Models.StaticStore;
|
|
using Bit.Core.Utilities;
|
|
using Xunit;
|
|
|
|
namespace Bit.Core.Test.Utilities;
|
|
|
|
|
|
public class StaticStoreTests
|
|
{
|
|
[Fact]
|
|
public void StaticStore_Initialization_Success()
|
|
{
|
|
var plans = StaticStore.Plans;
|
|
Assert.NotNull(plans);
|
|
Assert.NotEmpty(plans);
|
|
Assert.Equal(17, plans.Count());
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(PlanType.EnterpriseAnnually)]
|
|
public void StaticStore_GetPasswordManagerPlanByPlanType_Success(PlanType planType)
|
|
{
|
|
var plan = StaticStore.GetPasswordManagerPlan(planType);
|
|
|
|
Assert.NotNull(plan);
|
|
Assert.Equal(planType, plan.Type);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(PlanType.EnterpriseAnnually)]
|
|
public void StaticStore_GetSecretsManagerPlanByPlanType_Success(PlanType planType)
|
|
{
|
|
var plan = StaticStore.GetSecretsManagerPlan(planType);
|
|
|
|
Assert.NotNull(plan);
|
|
Assert.Equal(planType, plan.Type);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(PlanType.EnterpriseAnnually)]
|
|
public void StaticStore_GetPasswordManagerPlan_ReturnsPasswordManagerPlans(PlanType planType)
|
|
{
|
|
var plan = StaticStore.GetPasswordManagerPlan(planType);
|
|
Assert.NotNull(plan);
|
|
Assert.Equal(BitwardenProductType.PasswordManager, plan.BitwardenProduct);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(PlanType.EnterpriseAnnually)]
|
|
public void StaticStore_GetSecretsManagerPlan_ReturnsSecretManagerPlans(PlanType planType)
|
|
{
|
|
var plan = StaticStore.GetSecretsManagerPlan(planType);
|
|
Assert.NotNull(plan);
|
|
Assert.Equal(BitwardenProductType.SecretsManager, plan.BitwardenProduct);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(PlanType.EnterpriseAnnually, BitwardenProductType.PasswordManager)]
|
|
public void StaticStore_AddDuplicatePlans_SingleOrDefaultThrowsException(PlanType planType, BitwardenProductType bitwardenProductType)
|
|
{
|
|
var plansStore = new List<Plan>
|
|
{
|
|
new Plan { Type = PlanType.EnterpriseAnnually, BitwardenProduct = BitwardenProductType.PasswordManager },
|
|
new Plan { Type = PlanType.EnterpriseAnnually, BitwardenProduct = BitwardenProductType.PasswordManager }
|
|
};
|
|
|
|
Assert.Throws<InvalidOperationException>(() => plansStore.SingleOrDefault(p => p.Type == planType && p.BitwardenProduct == bitwardenProductType));
|
|
}
|
|
}
|