public void TestProposalsAuthoredByUser() { proposalRepository.Add(proposal); List <Proposal> proposals = proposalRepository.ProposalsAuthoredByUser(user.UserId); Assert.AreEqual(proposals.Count, 1); proposalRepository.Delete(proposal); userRepository.Delete(user); }
public void TestgetRejectedProposalsIds() { reviewRepository.Add(review); Assert.AreEqual(1, reviewRepository.getRejectedProposalsIds().Count); reviewRepository.Delete(review); proposalRepository.Delete(proposal); }
public void TestFindAllProposalsExistingInSections() { proposalRepository.Add(proposal); sectionRepository.Add(section); int initialValue = sectionRepository.FindAllProposalsExistingInSections().Count; Assert.AreEqual(0, initialValue); sectionRepository.AddProposalToSection(section, proposal); Assert.AreEqual((initialValue + 1), sectionRepository.FindAllProposalsExistingInSections().Count); proposalRepository.Delete(proposal); sectionRepository.Delete(section); }
public void deleteProposalsWithoutFull() { List <Proposal> proposalsWithoutFull = proposalRepository.getProposalsWithoutFull(); foreach (Proposal prop in proposalsWithoutFull) { foreach (User author in prop.Authors) { Role role = roleRepository.getBySlug("listner"); author.UserRoles = new List <UserRole>() { new UserRole() { Role = role, RoleId = role.RoleId, User = author, UserId = author.UserId } }; userRepository.Update(author); } proposalRepository.Delete(prop); } }
public void deleteRejectedProposals() { List <int> rejectedProposalsIds = reviewRepo.getRejectedProposalsIds(); foreach (int id in rejectedProposalsIds) { foreach (User author in getProposal(id).Authors) { Role role = roleRepository.getBySlug("listner"); author.UserRoles = new List <UserRole>() { new UserRole() { Role = role, RoleId = role.RoleId, User = author, UserId = author.UserId } }; userRepo.Update(author); } proposalRepo.Delete(proposalRepo.Find(id)); } }