Esempio n. 1
0
        public async Task ShouldSyncIdeeWithGitHubIssues()
        {
            BotANick.Discord.Program.Main(new string[] { });
            var  gitHubService       = new GitHubService();
            var  random              = new Random();
            var  expectedDescription = random.NextDouble().ToString();
            Idee idee = new Idee()
            {
                Description = expectedDescription,
            };
            List <Idee> idees = new List <Idee> {
                idee
            };

            await gitHubService.CreateGitHubIssuesForMissingIdees(idees);

            var createdIssue = await gitHubService.GetLastIssue();

            createdIssue.Title.Should().Be(expectedDescription);
            await ClearIssue(gitHubService, createdIssue);
        }
Esempio n. 2
0
        private static async Task UpdateIdees(SqlLiteContext dbContext, SocketTextChannel boiteChannel)
        {
            var             idees = _boiteAIdee.GetAllIdees(dbContext);
            List <IMessage> msgs  = await GetAllMsgs(boiteChannel);

            await AddMessagesForMissingIdee(idees, msgs);

            var gitHubService = new GitHubService();
            await gitHubService.CreateGitHubIssuesForMissingIdees(idees);

            dbContext.SaveChanges();

            foreach (var idee in idees)
            {
                var msgIdee = msgs.FirstOrDefault(msg => msg.Id == idee.IdMsgDiscord);
                idee.UpdateIdee(msgIdee);
                dbContext.SaveChanges();
                await UpdateDiscordMessage(idee, msgIdee);
            }

            dbContext.SaveChanges();
        }