Пример #1
0
        public async Task TestCalcPermissionsForUserAsyncWithModule()
        {
            //SETUP
            var fakeAuthChanges = new FakeAuthChanges();
            var options         = SqliteInMemory.CreateOptions <ExtraAuthorizeDbContext>();

            using (var context = new ExtraAuthorizeDbContext(options, fakeAuthChanges))
            {
                context.Database.EnsureCreated();
                context.SeedUserWithDefaultPermissions(PaidForModules.Feature1);

                var calc = new CalcAllowedPermissions(context);
                //ATTEMPT
                var packedP = await calc.CalcPermissionsForUserAsync("userId");

                //VERIFY
                packedP.UnpackPermissionsFromString().ShouldEqual(new List <Permissions> {
                    Permissions.StockRead, Permissions.Feature1Access
                });
            }
        }