コード例 #1
0
            public HasPermissionAsync()
            {
                _discordGuild = MockHelper.CreateDiscordGuild(0, 1);
                _discordRole  = MockHelper.CreateDiscordRole(0);

                var mock = new Mock <IGuildUser>();

                mock.Setup(u => u.Id).Returns(0);
                mock.Setup(u => u.RoleIds).Returns(new List <ulong> {
                    _discordRole.Id
                });

                _discordUser = mock.Object;

                var ownerMock = new Mock <IGuildUser>();

                ownerMock.Setup(u => u.Id).Returns(1);
                ownerMock.Setup(u => u.RoleIds).Returns(new List <ulong> {
                    _discordRole.Id
                });

                _discordGuildOwner = ownerMock.Object;

                _permission = new TestPermission();
            }
コード例 #2
0
            public override async Task InitializeAsync()
            {
                var guild       = MockHelper.CreateDiscordGuild(0);
                var discordRole = MockHelper.CreateDiscordRole(1, guild);

                var result = await this.Characters.CreateCharacterRoleAsync
                             (
                    discordRole,
                    RoleAccess.Open
                             );

                _role = result.Entity;
            }
コード例 #3
0
            public override async Task InitializeAsync()
            {
                var user = (await this.Users.GetOrRegisterUserAsync(_owner)).Entity;

                _character = new Character((long)_guild.Id, user, CharacterName);

                this.Database.Characters.Update(_character);

                var createRoleResult = await this.Characters.CreateCharacterRoleAsync
                                       (
                    MockHelper.CreateDiscordRole(2, _guild),
                    RoleAccess.Open
                                       );

                _role = createRoleResult.Entity;

                await this.Database.SaveChangesAsync();
            }
コード例 #4
0
 public GetCharacterRoleAsync()
 {
     _discordGuild            = MockHelper.CreateDiscordGuild(0);
     _discordRole             = MockHelper.CreateDiscordRole(1, _discordGuild);
     _unregisteredDiscordRole = MockHelper.CreateDiscordRole(2, _discordGuild);
 }
コード例 #5
0
            public GrantPermissionToRoleAsync()
            {
                _discordRole = MockHelper.CreateDiscordRole(0);

                _permission = new TestPermission();
            }
コード例 #6
0
 public CreateCharacterRoleAsync()
 {
     _discordGuild = MockHelper.CreateDiscordGuild(0);
     _discordRole  = MockHelper.CreateDiscordRole(1, _discordGuild);
 }
コード例 #7
0
            public RevokePermissionFromRoleAsync()
            {
                _discordRole = MockHelper.CreateDiscordRole(0);

                _permission = new TestPermission();
            }
コード例 #8
0
            public SetCharacterRoleAccessAsync()
            {
                var guild = MockHelper.CreateDiscordGuild(0);

                _discordRole = MockHelper.CreateDiscordRole(1, guild);
            }