Add freemium access economy and token store
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using QuestionsApi.Models;
|
||||
using Xunit;
|
||||
|
||||
namespace QuestionsApi.Tests;
|
||||
|
||||
public sealed class AccessCatalogTests
|
||||
{
|
||||
[Fact]
|
||||
public void FreeEconomy_HasTheReleaseLimits()
|
||||
{
|
||||
Assert.Equal(20, AccessCatalog.FreeQuestionLimit);
|
||||
Assert.Equal(20, AccessCatalog.CreditEarningLimit);
|
||||
Assert.Equal(100, AccessCatalog.DayPassCreditCost);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("access_day_1", 100, AccessGrant.DayToken)]
|
||||
[InlineData("access_week_1", 500, AccessGrant.WeekToken)]
|
||||
[InlineData("access_month_1", 2000, AccessGrant.MonthToken)]
|
||||
[InlineData("exam_token_1", 199, AccessGrant.ExamToken)]
|
||||
[InlineData("qbank_reset_1", 499, AccessGrant.ResetToken)]
|
||||
public void Products_HaveServerControlledPrices(string sku, long cents, string grant)
|
||||
{
|
||||
var product = AccessCatalog.Products[sku];
|
||||
|
||||
Assert.Equal(cents, product.AmountCents);
|
||||
Assert.Equal("usd", product.Currency);
|
||||
Assert.Equal(grant, product.Grant);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user