Ejemplo n.º 1
0
        public async Task Should_return_false_when_permission_set_is_not_valid()
        {
            using (var dbContext = new AtlasDbContext(Shared.CreateContextOptions()))
            {
                var sut    = new PermissionSetRules(dbContext);
                var actual = await sut.IsValidAsync(Guid.NewGuid(), Guid.NewGuid());

                Assert.IsFalse(actual);
            }
        }
Ejemplo n.º 2
0
        public async Task Should_return_true_when_permission_set_is_valid()
        {
            var options       = Shared.CreateContextOptions();
            var site          = new Site(Guid.NewGuid(), "Name", "Title");
            var permissionSet = new PermissionSet(Guid.NewGuid(), site.Id, "Permission Set", new List <PermissionCommand>());

            using (var dbContext = new AtlasDbContext(options))
            {
                dbContext.Sites.Add(site);
                dbContext.PermissionSets.Add(permissionSet);
                await dbContext.SaveChangesAsync();
            }

            using (var dbContext = new AtlasDbContext(Shared.CreateContextOptions()))
            {
                var sut    = new PermissionSetRules(dbContext);
                var actual = await sut.IsValidAsync(site.Id, permissionSet.Id);

                Assert.IsTrue(actual);
            }
        }