public void IsUserLikedQuestion_Must_Return_False_If_User_Not_Liked_Given_Question() { // 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 addedQuestion = discussionsService.AddQuestion(testQBM, testUser); var result = discussionsService.IsUserLikedQuestion(addedQuestion.Id, testUser.UserName); //Assert Assert.True(!result); }
public void IsUserLikedQuestion_Must_Return_True_If_User_Liked_Given_Question() { // 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 addedQuestion = discussionsService.AddQuestion(testQBM, testUser); var questionRatingBindingModel = GetTestQuestionRatingBMRatingUp(addedQuestion); var ratedQuestion = discussionsService.RateQuestion(questionRatingBindingModel, testUser); var result = discussionsService.IsUserLikedQuestion(ratedQuestion.Id, testUser.Id); //Assert Assert.True(result); }