Example #1
0
        public async Task Can_CreateAndDelete_Group()
        {
            using (var ctx = new MarbleContext(this.Options))
                using (var cmd = new CommandLayer(ctx, this.Principal))
                    using (var query = new QueryLayer(ctx, this.Principal))
                    {
                        var username = "******";
                        await cmd.CreateUser(username);

                        var user = await query.GetUserAsync(username);

                        await cmd.CreateGroup("test", user.Id);

                        var groupId = ctx.Groups.FirstOrDefault().Id;

                        await cmd.RemoveGroup(groupId);

                        var actual = await query.GetGroupAsync(groupId);

                        Group expected = null;

                        Assert.AreEqual(actual, expected);
                    }
        }