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(); }
public void ShouldGetAllIdeeNotArchivedFromBoite() { var boite = new BoiteAIdee(); Idee newIdeeNotArchived = new Idee(); Idee newIdeeArchived = new Idee() { IsArchived = true, }; List <Idee> expectedIdeesList = new List <Idee> { newIdeeNotArchived }; using (var dbContext = new DataInMemoryContext(MethodBase.GetCurrentMethod().Name)) { dbContext.Idee.Add(newIdeeArchived); dbContext.Idee.Add(newIdeeNotArchived); dbContext.SaveChanges(); var ideesFromBoite = boite.GetAllIdees(dbContext).ToList(); ideesFromBoite.Should().BeEquivalentTo(expectedIdeesList); } }