public void GetUserDisLikedAnswersIdList_Must_Return_User_Liked_Answers_Ids_In_List() { // Arrange var db = StaticMethods.GetDb(); var discussionsService = new DiscussionsService(db, this.mapper); var testUser = StaticMethods.GetTestUser(); var testQBM = GetTestQuestionBM(); var content1 = "Test Answer"; var content2 = "Test Answer"; //Act db.Users.Add(testUser); db.SaveChanges(); var addedQuestion = discussionsService.AddQuestion(testQBM, testUser); var answer1 = discussionsService.AddAnswer(content1, testUser, addedQuestion.Id); var answer2 = discussionsService.AddAnswer(content2, testUser, addedQuestion.Id); //// Like First Answer var testAnswerRatingBM1 = GetTestAnswerRatingBMRatingDown(answer1, testUser); var ratedAnswer1 = discussionsService.RateAnswer(testAnswerRatingBM1, testUser); //// Like Secont Answer testAnswerRatingBM1 = GetTestAnswerRatingBMRatingDown(answer2, testUser); var ratedAnswer2 = discussionsService.RateAnswer(testAnswerRatingBM1, testUser); var userLikedAnswers = discussionsService.GetUserDisLikedAnswersIdList(testUser.Id); //Assert Assert.True(userLikedAnswers.Count == 2); Assert.True(userLikedAnswers.Contains(answer1.Id)); Assert.True(userLikedAnswers.Contains(answer2.Id)); }
public void GetUserDisLikedAnswersIdList_Must_Return_Empty_List_If_User_Havent_Disliked_Any_Answer() { // Arrange var db = StaticMethods.GetDb(); var discussionsService = new DiscussionsService(db, this.mapper); var testUser = StaticMethods.GetTestUser(); var testQBM = GetTestQuestionBM(); //Act db.Users.Add(testUser); db.SaveChanges(); var userLikedAnswers = discussionsService.GetUserDisLikedAnswersIdList(testUser.UserName); //Assert Assert.True(userLikedAnswers.Count == 0); }