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}"); }
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"); }