Beispiel #1
0
        public async Task CreateRole(CommandContext ctx, DiscordRole role, string?aliasList = null)
        {
            var appDiscordRole = DiscordRoleMapper.Map(role);

            await _userRoleService.CreateRole(appDiscordRole, aliasList);

            await ctx.RespondAsync($"Created user role for {role.Name}");
        }
Beispiel #2
0
        public void CreateRole_UserRoleAlreadyExists_ThrowException()
        {
            var discordRole = new AppDiscordRole();
            var aliases     = "alias";

            _userRoleRepoMock
            .Setup(x => x.GetRoleByDiscordRoleId(It.IsAny <ulong>()))
            .ReturnsAsync(new UserRole());

            _sut = BuildSutWithMocks();

            Func <Task> act = async() => await _sut.CreateRole(discordRole, aliases);

            act.Should()
            .ThrowAsync <ArgumentException>()
            .WithMessage("User role already exists");
        }