public void CleanUp()
 {
     Comment[] comments = Repository.GetAll();
     foreach (Comment comment in comments)
     {
         Repository.Remove(comment);
     }
 }
Exemple #2
0
        public void CleanUp()
        {
            Comment[] comments = Repository.GetAll();
            foreach (Comment comment in comments)
            {
                Repository.Remove(comment);
            }

            InfrastructureTestsSeed.RemoveAll(Context);
        }
Exemple #3
0
 public ActionResult <IEnumerable <CommentModel> > GetAllComments()
 {
     try
     {
         return(_repository.GetAll());
     }
     catch (Exception e)
     {
         return(null);
     }
 }
        public IHttpActionResult GetComments(int id)
        {
            List <Comment> comments = comRepo.GetAll().Where <Comment>(x => x.PostId == id).ToList();

            if (comments.Count <= 0)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            else
            {
                return(Ok(comments));
            }
        }
        public IEnumerable <CommentViewModel> FromBltoUiGetAll()
        {
            var getData       = _commentRepository.GetAll().ToList();
            var randomComment = Mapper.Map <List <Comment>, IEnumerable <CommentViewModel> >(getData);

            return(randomComment);
        }
Exemple #6
0
        public IEnumerable <Comment> GetComments(string key)
        {
            SmartList <Comment> comments = _repository.GetAll(key, CurrentUserId).ToSmartList();

            _repository.MarkAsReaded(key, CurrentUserId);
            return(comments);
        }
Exemple #7
0
        public void GetAll_CallMethod_NotNull()
        {
            //Arrange
            var commentStub = new List <Comment>()
            {
                new Comment()
                {
                    Id = 1
                },
                new Comment(),
                new Comment()
            };

            DbSet <Comment> dbSetComments = GetQueryableMockDbSet(commentStub);

            var forumDatabaseContext = new Mock <ForumDatabaseContext>();

            forumDatabaseContext.Setup(c => c.Comments).Returns(dbSetComments);

            CommentRepository commentRepository = new CommentRepository(forumDatabaseContext.Object);

            //Act
            var actualComments = commentRepository.GetAll();

            //Assert
            Assert.Equal(actualComments.Count(), commentStub.Count());
            Assert.Equal(actualComments.First().Id, commentStub.First().Id);
        }
Exemple #8
0
        public IEnumerable <CommentViewModel> GetAll()
        {
            List <Comment> comments = _commentRepository.GetAll().ToList();
            var            result   = Mapper.Map <List <Comment>, List <CommentViewModel> >(comments);

            return(result);
        }
Exemple #9
0
        public IEnumerable <CommentInfo> GetAll()
        {
            var commentsEntity = repository.GetAll();
            var commentsInfo   = AutoMapper.Mapper.Map <IEnumerable <CommentInfo> >(commentsEntity);

            return(commentsInfo);
        }
Exemple #10
0
        private void LoadCommentData()
        {
            TracktorDb           context     = new TracktorDb();
            CommentRepository    commentRepo = new CommentRepository(context);
            List <CommentEntity> comments    = commentRepo.GetAll().ToList();

            AllComments = new BindingList <CommentEntity>(comments);
        }
Exemple #11
0
        public async Task <ActionResult <IEnumerable <CommentResponse> > > GetComments()
        {
            var comments = await _commentRepository.GetAll();

            var commentResponses = MapModelToResponse(comments);

            return(commentResponses);
        }
Exemple #12
0
        public void GetAll_ShouldGetAll()
        {
            // Act
            var comments = repo.GetAll();

            // Assert
            comments.Should().BeEquivalentTo(testCommnets);
        }
        public void CommentRepozitoryTest()
        {
            var Repository = new CommentRepository(new InMemoryDbContextFactory());

            Assert.Throws <System.InvalidOperationException>(() => Repository.GetById(0));

            var Comment1 = new CommentModel()
            {
                Author     = 1,
                AuthorName = "Milos Hlava",
                Date       = new DateTime(2019, 1, 4),
                Id         = 1,
                Text       = "Testovaci koment"
            };

            var Comment2 = new CommentModel()
            {
                Author     = 2,
                AuthorName = "Jozef Hlava",
                Date       = new DateTime(2019, 1, 5),
                Id         = 2,
                Text       = "Testovaci koment cislo 2"
            };

            Repository.Create(Comment1);
            Repository.Create(Comment2);
            var ReceivedComment1 = Repository.GetById(1);
            var ReceivedComment2 = Repository.GetById(2);

            Assert.Equal(Comment1, ReceivedComment1);
            Assert.Equal(Comment2, ReceivedComment2);

            Comment1.Text = "Updatovany text";
            Repository.Update(Comment1);
            ReceivedComment1 = Repository.GetById(1);

            Assert.Equal(Comment1, ReceivedComment1);

            List <CommentModel> ReceivedAllComments = Repository.GetAll();

            var AllComments = new List <CommentModel>();

            AllComments.Add(Comment1);
            AllComments.Add(Comment2);

            var Comparer = new CollectionComparer <CommentModel>();

            Assert.True(Comparer.Equals(AllComments, ReceivedAllComments));

            Repository.Delete(1);

            Assert.Throws <System.InvalidOperationException>(() => Repository.GetById(1));

            Repository.Delete(2);

            Assert.Throws <System.InvalidOperationException>(() => Repository.GetById(2));
        }
Exemple #14
0
        public IHttpActionResult GetAllComments()
        {
            var comments = _commentRepository.GetAll().ToList();

            if (comments != null)
            {
                return(Ok(new { results = comments.Select(Mapper.Map <Comment, CommentDto>) }));
            }
            return(NotFound());
        }
Exemple #15
0
        public void TestEntityGetAll()
        {
            var mockTeste = new Mock <IGetDB <Comment> >();

            var commentRepository = new CommentRepository(mockTeste.Object);

            commentRepository.GetAll();

            mockTeste.Verify(x => x.GetAllRegister());
        }
        public void GetAllTest()
        {
            var data = repository.GetAll();

            //Xunit.Assert.NotNull(data);
            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNotNull(data);

            //Xunit.Assert.True(data.Count() > 0);
            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsTrue(data.Count() > 0);
        }
Exemple #17
0
        public ActionResult DeleteComment(int id)
        {
            List <Comment>    comments          = new List <Comment>();
            CommentRepository commentRepository = new CommentRepository();

            comments = commentRepository.GetAll(filter: c => c.Id == id || c.ParentComment.Id == id);
            foreach (var comment in comments)
            {
                commentRepository.Delete(comment);
            }
            return(RedirectToAction("Articles"));
        }
Exemple #18
0
        public void GetComment_Call_GetResults_Test()
        {
            var context       = new MyEventsContext();
            int sessionId     = context.Comments.FirstOrDefault().SessionId;
            int expectedCount = context.Comments.Count(q => q.SessionId == sessionId);

            ICommentRepository target = new CommentRepository();

            IEnumerable <Comment> results = target.GetAll(sessionId);

            Assert.IsNotNull(results);
            Assert.AreEqual(expectedCount, results.Count());
        }
        public IHttpActionResult GetAll()
        {
            var comments       = _commentRepository.GetAll();
            var resultComments = comments.Select(comment => new Comment
            {
                Id          = comment.Id,
                EventId     = comment.EventId,
                Description = comment.Description,
                Date        = comment.Date,
                UserId      = comment.UserId
            });

            return(Ok(resultComments));
        }
        public ActionResult TaskDetails(int id)
        {
            if (AuthenticationManager.LoggedUser == null)
            {
                return(RedirectToAction("Login", "Home"));
            }

            TaskRepository    taskrepo = RepositoryFactory.GetTaskRepository();
            CommentRepository comrepo  = RepositoryFactory.GetCommentRepository();

            ViewData["task"]     = taskrepo.GetByID(id);
            ViewData["comments"] = comrepo.GetAll(id);
            return(View());
        }
Exemple #21
0
        // GET: CommentManagement
        public ActionResult Index(int?ParentTaskId)
        {
            if (AuthenticationManager.LoggedUser == null && ParentTaskId == null)
            {
                return(RedirectToAction("Login", "Home"));
            }

            TaskRepository    RepoTask    = RepositoryFactory.GetTaskRepository();
            CommentRepository RepoComment = RepositoryFactory.GetCommentRepository();

            ViewData["task"]     = RepoTask.GetById(ParentTaskId.Value);
            ViewData["comments"] = RepoComment.GetAll(ParentTaskId.Value);

            return(View());
        }
Exemple #22
0
        private void List()
        {
            Console.Clear();

            List <Comment> comments = new List <Comment>();

            CommentRepository commentRepo = new CommentRepository();

            comments = commentRepo.GetAll(task.ID);

            foreach (Comment comment in comments)
            {
                Console.WriteLine("Text: " + comment.Text);
                Console.WriteLine("Created Date: " + comment.CreateDate);
            }

            Console.ReadKey(true);
        }
Exemple #23
0
        public void CanGetAllCommentsFromPostgre()
        {
            var commentRepository = new CommentRepository(dbConnectionString);
            var articleId         = Guid.NewGuid();
            var commentText       = Guid.NewGuid().ToString();
            var commentUserName   = "******";

            commentRepository.Add(new Comment
            {
                Text      = commentText,
                Author    = commentUserName,
                ArticleId = articleId
            });
            IList <Comment> comments = commentRepository.GetAll();

            Assert.NotNull(comments);
            Assert.AreEqual(2, comments.Count);
            Assert.IsTrue(comments.Any(x => x.Text == commentText));
        }
Exemple #24
0
        private List <Tuple <Document, float> > LoadTable()
        {
            IEnumerable <Comment>  comments  = CommentRepository.GetAll();
            IEnumerable <Document> documents = DocumentRepository.GetAll();

            List <Tuple <Document, float> > documentAndPromedys = new List <Tuple <Document, float> >();

            foreach (Document document in documents)
            {
                Tuple <Document, float> documentAndPromedy;

                if (!(comments.Any(d => d.Document.Id == document.Id)))
                {
                    documentAndPromedy = new Tuple <Document, float>(document, 0);
                }
                else
                {
                    float cumulativeRating = 0;
                    float numberOfRatings  = 0;

                    foreach (Comment comment in comments)
                    {
                        if (comment.Document.Id == document.Id)
                        {
                            numberOfRatings++;
                            cumulativeRating = cumulativeRating + comment.Rating;
                        }
                    }

                    float promedy = cumulativeRating / numberOfRatings;
                    documentAndPromedy = new Tuple <Document, float>(document, promedy);
                }
                documentAndPromedys.Add(documentAndPromedy);
            }

            return(documentAndPromedys);
        }
Exemple #25
0
        public void CanDeleteCommentFromPostgre()
        {
            var commentRepository = new CommentRepository(dbConnectionString);
            var articleId         = Guid.NewGuid();
            var commentText       = "Test Text";
            var commentUserName   = "******";

            commentRepository.Add(new Comment
            {
                Text      = commentText,
                Author    = commentUserName,
                ArticleId = articleId
            });
            List <Comment> comments = commentRepository.GetAll();

            Assert.IsNotEmpty(comments);
            var comment = comments.Last();

            Assert.NotNull(comment);
            commentRepository.Delete(comment.Id);
            comment = commentRepository.Get(comment.Id).Value;

            Assert.IsNull(comment);
        }
Exemple #26
0
        public void CanDeleteCommentsFromPostgre()
        {
            var commentRepository = new CommentRepository(dbConnectionString);
            var articleId         = Guid.NewGuid();
            var commentText       = "Test Text";
            var commentUserName   = "******";

            var secondcommentText     = "Second Test Text";
            var secondcommentUserName = "******";

            commentRepository.Add(new Comment
            {
                Text      = commentText,
                Author    = commentUserName,
                ArticleId = articleId
            });

            commentRepository.Add(new Comment
            {
                Text      = secondcommentText,
                Author    = secondcommentUserName,
                ArticleId = articleId
            });

            List <Comment> comments = commentRepository.GetAll();

            Assert.IsNotEmpty(comments);

            comments.Reverse();
            List <Guid> commentsToDelete = comments.Take(2).Select(x => x.Id).ToList();

            commentRepository.Delete(commentsToDelete);
            Comment comment = commentRepository.Get(commentsToDelete.First()).Value;

            Assert.IsNull(comment);
        }
Exemple #27
0
        public void CanAddCommentToPostgre()
        {
            var commentRepository = new CommentRepository(dbConnectionString);
            var articleId         = Guid.NewGuid();
            var commentText       = "Test Text";
            var commentUserName   = "******";

            commentRepository.Add(new Comment
            {
                Text      = commentText,
                Author    = commentUserName,
                ArticleId = articleId
            });
            List <Comment> comments = commentRepository.GetAll();

            Assert.IsNotEmpty(comments);

            var comment = comments.First();

            Assert.NotNull(comment);
            Assert.AreEqual(commentText, comment.Text);
            Assert.AreEqual(commentUserName, comment.Author);
            Assert.AreEqual(articleId, comment.ArticleId);
        }
        public void GetAllReturnsEmpty()
        {
            var repository = new CommentRepository(dbFactory, personRepository, issueRepository);

            var response = repository.GetAll();

            Assert.IsNotNull(response);
            Assert.AreEqual(response.Count, 0);
        }
 public IActionResult Get()
 {
     return(Ok(_commentRepo.GetAll()));
 }
        public void GetComment_Call_GetResults_Test()
        {
            var context = new MyEventsContext();
            int sessionId = context.Comments.FirstOrDefault().SessionId;
            int expectedCount = context.Comments.Count(q => q.SessionId == sessionId);

            ICommentRepository target = new CommentRepository();

            IEnumerable<Comment> results = target.GetAll(sessionId);

            Assert.IsNotNull(results);
            Assert.AreEqual(expectedCount, results.Count());
        }
 public ActionResult DeleteComment(int id)
 {
     List<Comment> comments = new List<Comment>();
     CommentRepository commentRepository = new CommentRepository();
     comments = commentRepository.GetAll(filter: c => c.Id == id || c.ParentComment.Id == id);
     foreach (var comment in comments)
     {
         commentRepository.Delete(comment);
     }
     return RedirectToAction("Articles");
 }
        public ActionResult Articles()
        {
            if (AuthenticationManager.LoggedUser == null)
            {
                return RedirectToAction("Login", "Default");
            }
            List<Article> articleList = new List<Article>();
            ArticleRepository articleRepository = new ArticleRepository();
            Dictionary<int, List<Comment>> comments = new Dictionary<int, List<Comment>>();
            CommentRepository commentRepository = new CommentRepository();
            Dictionary<int, string> userDictionary = new Dictionary<int, string>();
            List<int> subjectId = new List<int>();
            Teacher teacher = new Teacher();
            TeacherRepository teacherRepository = new TeacherRepository();
            Student student = new Student();
            StudentRepository studentRepository = new StudentRepository();
            List<Article> list = new List<Article>();
            if (AuthenticationManager.LoggedUser.GetType().BaseType.Equals(typeof(Teacher)))
            {
                teacher = teacherRepository.GetById(AuthenticationManager.LoggedUser.Id);
                foreach (var item in teacher.CourseSubject)
                {
                    subjectId.Add(item.Subject.Id);
                }
            }
            else if (AuthenticationManager.LoggedUser.GetType().BaseType.Equals(typeof(Student)))
            {
                student = studentRepository.GetById(AuthenticationManager.LoggedUser.Id);
                List<CourseSubject> courseSubjectList = new List<CourseSubject>();
                CourseSubjectRepository courseSubjectRepository = new CourseSubjectRepository();
                courseSubjectList = courseSubjectRepository.GetAll(filter: cs => cs.CourseID == student.CourseID);
                foreach (var item in courseSubjectList)
                {
                    subjectId.Add(item.Subject.Id);
                }
            }
            subjectId = subjectId.Distinct().ToList();
            foreach (var item in subjectId)
            {
                List<Article> article = articleRepository.GetAll(filter: s => s.Subject.Id == item);
                if (article != null)
                {
                    articleList.AddRange(article);
                }
            }
            articleList = articleList.OrderBy(d => d.DateCreated.TimeOfDay).ToList();
            articleList.Reverse();
            ArticleControllerArticlesVM model = new ArticleControllerArticlesVM();
            LikeRepository likeRepository = new LikeRepository();
            Dictionary<Article, int> ArticlesAndLikeCount = new Dictionary<Article, int>();
            Dictionary<int, bool> Liked = new Dictionary<int, bool>();
            int articleId = 0;
            string type = AuthenticationManager.LoggedUser.GetType().BaseType.ToString();
            int start = type.LastIndexOf(".") + 1;
            int positions = type.Length - start;
            type = type.Substring(start, positions);
            foreach (var item in articleList)
            {
                List<Comment> commentedCommentList = new List<Comment>();
                commentedCommentList = commentRepository.GetAll(filter: c => c.Article.Id == item.Id);
                commentedCommentList.OrderBy(c => c.DateCreated.TimeOfDay).ToList();
                commentedCommentList.Reverse();
                foreach (var comment in commentedCommentList)
                {
                    string userName = "";
                    if (comment.UserType == "Teacher")
                    {
                        teacher = teacherRepository.GetById(comment.UserID);
                        if (teacher != null)
                        {
                            userName = teacher.FirstName + " " + teacher.LastName;
                            userDictionary.Add(comment.Id, userName);
                        }
                    }
                    else
                    {
                        student = studentRepository.GetById(comment.UserID);
                        userName = student.FirstName + " " + student.LastName;
                        userDictionary.Add(comment.Id, userName);
                    }
                }
                comments.Add(item.Id, commentedCommentList);
                int count = likeRepository.GetAll(filter: a => a.ArticleID == item.Id).Count;
                ArticlesAndLikeCount.Add(item, count);
                List<Like> likes = new List<Like>();

                likes = likeRepository.GetAll(l => l.ArticleID == item.Id);
                foreach (var like in likes.Where(l => l.UserID == AuthenticationManager.LoggedUser.Id && l.UserType == type))
                {
                    Liked.Add(item.Id, true);
                }
                model.ArticleId = item.Id;
                if (Liked.Count != ArticlesAndLikeCount.Count)
                {
                    foreach (var dictionary in ArticlesAndLikeCount.Where(a => a.Key.Id == item.Id))
                    {
                        articleId = item.Id;
                    }
                    Liked.Add(articleId, false);
                }
            }
            model.UserType = type;
            model.IsLiked = Liked;
            model.UserID = AuthenticationManager.LoggedUser.Id;
            model.Articles = ArticlesAndLikeCount;
            model.CommentList = comments;
            model.UserDictionary = userDictionary;
            return View(model);
        }
Exemple #33
0
 // GET: /<controller>/
 public IActionResult Index()
 {
     return(View(_commentRepository.GetAll()));
 }
        public void AddNewFormThenRemoveItReturnsTrue()
        {
            var options = new DbContextOptionsBuilder <EvaluationContext>()
                          .UseInMemoryDatabase(databaseName: MethodBase.GetCurrentMethod().Name)
                          .Options;

            using (var memoryContext = new EvaluationContext(options))
            {
                //Arrange
                ICommentRepository             commentRepository             = new CommentRepository(memoryContext);
                IFormRepository                formRepository                = new FormRepository(memoryContext);
                IResponseRepository            responseRepository            = new ResponseRepository(memoryContext);
                IQuestionRepository            questionRepository            = new QuestionRepository(memoryContext);
                ISubmissionRepository          submissionRepository          = new SubmissionRepository(memoryContext);
                IQuestionPropositionRepository questionPropositionRepository = new QuestionPropositionRepository(memoryContext);

                #region Form

                var Form1 = new FormTO
                {
                    Name = new MultiLanguageString
                           (
                        "Daily evaluation form",
                        "Formulaire d'évaluation journalier",
                        "Dagelijks evaluatieformulier"
                           ),
                };
                var formAdded1 = formRepository.Add(Form1);
                memoryContext.SaveChanges();

                #endregion

                #region Questions

                var Question1 = new QuestionTO
                {
                    Form     = formAdded1,
                    Position = 1,
                    Libelle  = new MultiLanguageString
                               (
                        "What is your general impression after this first day of training ?",
                        "Quelle est votre impression générale après cette première journée de formation ?",
                        "Wat is je algemene indruk na deze eerste dag van training ?"
                               ),
                    Type = QuestionType.SingleChoice,
                };

                var Question2 = new QuestionTO
                {
                    Form     = formAdded1,
                    Position = 2,
                    Libelle  = new MultiLanguageString
                               (
                        "Is the pace right for you ?",
                        "Est-ce que le rythme vous convient ?",
                        "Is het tempo geschikt voor u ?"
                               ),
                    Type = QuestionType.SingleChoice,
                };

                var Question3 = new QuestionTO
                {
                    Form     = formAdded1,
                    Position = 3,
                    Libelle  = new MultiLanguageString
                               (
                        "Do you have questions related to the subject studied today ?",
                        "Avez-vous des questions relatives à la matière étudiée aujourd’hui ?",
                        "Heb je vragen over het onderwerp dat vandaag is bestudeerd ?"
                               ),
                    Type = QuestionType.Open
                };

                var Question4 = new QuestionTO
                {
                    Form     = formAdded1,
                    Position = 4,
                    Libelle  = new MultiLanguageString
                               (
                        "Do you have specific questions / particular topics that you would like deepen during this training ?",
                        "Avez-vous des questions spécifiques/sujets particuliers que vous aimeriez approfondir durant cette formation ?",
                        "Heeft u specifieke vragen / specifieke onderwerpen die u graag zou willen verdiepen tijdens deze training ?"
                               ),
                    Type = QuestionType.Open
                };

                var Question5 = new QuestionTO
                {
                    Form     = formAdded1,
                    Position = 5,
                    Libelle  = new MultiLanguageString
                               (
                        "What objectives do you pursue by following this training ?",
                        "Quels objectifs poursuivez-vous en suivant cette formation ?",
                        "Welke doelstellingen streeft u na door deze training te volgen?"
                               ),
                    Type = QuestionType.Open
                };

                var questionAdded1 = questionRepository.Add(Question1);
                var questionAdded2 = questionRepository.Add(Question2);
                var questionAdded3 = questionRepository.Add(Question3);
                var questionAdded4 = questionRepository.Add(Question4);
                var questionAdded5 = questionRepository.Add(Question5);
                memoryContext.SaveChanges();

                #endregion

                #region QuestionProposition
                var QuestionProposition1 = new QuestionPropositionTO
                {
                    Question = questionAdded1,
                    Libelle  = new MultiLanguageString("good", "bonne", "goed"),
                    Position = 1
                };

                var QuestionProposition2 = new QuestionPropositionTO
                {
                    Question = questionAdded1,
                    Libelle  = new MultiLanguageString("medium", "moyenne", "gemiddelde"),
                    Position = 2
                };

                var QuestionProposition3 = new QuestionPropositionTO
                {
                    Question = questionAdded1,
                    Libelle  = new MultiLanguageString("bad", "mauvaise", "slecht"),
                    Position = 3
                };

                var QuestionProposition4 = new QuestionPropositionTO
                {
                    Question = questionAdded2,
                    Libelle  = new MultiLanguageString("yes", "oui", "ja"),
                    Position = 1
                };

                var QuestionProposition5 = new QuestionPropositionTO
                {
                    Question = questionAdded2,
                    Libelle  = new MultiLanguageString("too fast", "trop rapide", "te snel"),
                    Position = 2
                };

                var QuestionProposition6 = new QuestionPropositionTO
                {
                    Question = questionAdded2,
                    Libelle  = new MultiLanguageString("too slow", "trop lent", "te langzaam"),
                    Position = 3
                };

                var questionPropositionAdded1 = questionPropositionRepository.Add(QuestionProposition1);
                var questionPropositionAdded2 = questionPropositionRepository.Add(QuestionProposition2);
                var questionPropositionAdded3 = questionPropositionRepository.Add(QuestionProposition3);
                var questionPropositionAdded4 = questionPropositionRepository.Add(QuestionProposition4);
                var questionPropositionAdded5 = questionPropositionRepository.Add(QuestionProposition5);
                var questionPropositionAdded6 = questionPropositionRepository.Add(QuestionProposition6);

                memoryContext.SaveChanges();

                #endregion

                #region Submission
                var submission1 = new SubmissionTO
                {
                    SessionId  = 30,
                    AttendeeId = 1012,
                    Date       = DateTime.Today,
                };
                var submission2 = new SubmissionTO
                {
                    SessionId  = 31,
                    AttendeeId = 2607,
                    Date       = DateTime.Today,
                };
                var submission3 = new SubmissionTO
                {
                    SessionId  = 2,
                    AttendeeId = 1612,
                    Date       = DateTime.Today,
                };

                var submissionAdded1 = submissionRepository.Add(submission1);
                var submissionAdded2 = submissionRepository.Add(submission2);
                var submissionAdded3 = submissionRepository.Add(submission3);
                memoryContext.SaveChanges();

                #endregion

                #region Responses
                var response1 = new ResponseTO
                {
                    Question            = questionAdded1,
                    Submission          = submissionAdded1,
                    QuestionProposition = questionPropositionAdded1,
                };

                var response2 = new ResponseTO
                {
                    Question            = questionAdded2,
                    Submission          = submissionAdded2,
                    QuestionProposition = questionPropositionAdded2,
                };

                var response3 = new ResponseTO
                {
                    Question   = questionAdded3,
                    Submission = submissionAdded3,
                    Text       = "Ceci est une réponse à une question ouverte",
                    //QuestionProposition = QuestionProposition3,
                };

                var response4 = new ResponseTO
                {
                    Question   = questionAdded4,
                    Submission = submissionAdded1,
                    Text       = "Ceci est une réponse à une question ouverte",
                };

                //Assert
                var responseAdded1 = responseRepository.Add(response1);
                var responseAdded2 = responseRepository.Add(response2);
                var responseAdded3 = responseRepository.Add(response3);
                var responseAdded4 = responseRepository.Add(response4);
                memoryContext.SaveChanges();

                #endregion

                #region Comment
                var comment1 = new CommentTO
                {
                    Response = responseAdded1,
                    Content  = "ceci est un commentaire"
                };

                var comment2 = new CommentTO
                {
                    Response = responseAdded2,
                    Content  = "ceci est un commentaire"
                };

                var commentAdded1 = commentRepository.Add(comment1);
                var commentAdded2 = commentRepository.Add(comment2);
                memoryContext.SaveChanges();
                #endregion

                //Act
                var result1 = commentRepository.Remove(commentAdded1);
                var result2 = commentRepository.Remove(commentAdded2);
                memoryContext.SaveChanges();
                var count = commentRepository.GetAll().Count();

                //Assert
                Assert.IsTrue(result1);
                Assert.IsTrue(result2);
                Assert.AreEqual(0, count);
            }
        }
        public void GetAllReturnsItems()
        {
            dbFactory.Run(db =>
                              {
                                  db.Insert(new Comment { Id = 1, Message = "Test Item" });
                                  db.Insert(new Comment { Id = 2, Message = "Test Item 2" });
                              });

            var repository = new CommentRepository(dbFactory, personRepository, issueRepository);

            var response = repository.GetAll();

            Assert.IsNotNull(response);
            Assert.AreEqual(response.Count, 2);
            Assert.AreEqual(response.Single(x => x.Id == 1).Message, "Test Item");
            Assert.AreEqual(response.Single(x => x.Id == 2).Message, "Test Item 2");
        }