FakeXrmEasy automatically retrieves information about the current user using FakeXrmEasy, and will validate your subscription for you, however you’ll need to implement a SubscriptionStorageProvider interface that you’ll use to decide where the information about these users is stored / read from.
If you want to try and use Blob Storage, then there is an implementation already done in the next section: Tutorial - Blob Storage Implementation.
The SubscriptionStorageProvider interface basically needs to implement two methods:
These two methods are means of serialising (Write) and deserialising (Read) the Subscription usage data.
Once you have your SubscriptionStorageProvider, you need to tell FakeXrmEasy it exists and to use it. This is done in the middleware configuration.
Please make sure to call this method after the .SetLicense and before the .Build methods.
public class FakeXrmEasyCommercialLicenseTestsBase
{
protected readonly IXrmFakedContext _context;
protected readonly IOrganizationService _service;
public FakeXrmEasyCommercialLicenseTestsBase()
{
_context = MiddlewareBuilder
.New()
.AddCrud()
.AddFakeMessageExecutors(Assembly.GetAssembly(typeof(AddListMembersListRequestExecutor)))
.UseCrud()
.UseMessages()
.SetLicense(FakeXrmEasyLicense.Commercial)
// Your provider goes here ...
.SetSubscriptionStorageProvider(new SubscriptionBlobStorageProvider())
.Build();
_service = _context.GetOrganizationService();
}
}