public void GetAll_AllUserRatingsReturned_CountEqualsActual() { const int expectedCount = 8; int actualCount; using (var userRatingRepoRepo = new UserRatingRepository(new brothershipEntities(ConnectionStrings.TEST_CONNECTION_STRING_NAME))) { actualCount = userRatingRepoRepo.GetAll().Count(); } Assert.AreEqual(expectedCount, actualCount); }
public UserDataService() { ImdbContext context = new ImdbContext(); _users = new UserRepository(context); _bookmarks = new BookmarkRepository(context); _comments = new CommentsRepository(context); _searchHistory = new SearchHistoryRepository(context); _specialRoles = new SpecialRolesRepository(context); _userRatings = new UserRatingRepository(context); _flaggedComments = new FlaggedCommentsRepository(context); }
public void DeleteById_WasDeleted_ActualDataIsNull() { var userIntegrationToDelete = AddandGetTestUserRating(); UserRating actualUserRating; using (var userRatingRepo = new UserRatingRepository(new brothershipEntities(ConnectionStrings.TEST_CONNECTION_STRING_NAME))) { userRatingRepo.Delete(userIntegrationToDelete.RaterUserID, userIntegrationToDelete.UserBeingRatedID); userRatingRepo.SaveChanges(); actualUserRating = userRatingRepo.GetById(userIntegrationToDelete.RaterUserID, userIntegrationToDelete.UserBeingRatedID); } Assert.IsNull(actualUserRating); }
private UserRating AddandGetTestUserRating() { var userRating = new UserRating { RaterUserID = 4, UserBeingRatedID = 3, Comment = "Test comment", RatingID = 5 }; using (var userRatingRepo = new UserRatingRepository(new brothershipEntities(ConnectionStrings.TEST_CONNECTION_STRING_NAME))) { userRatingRepo.Add(userRating); userRatingRepo.SaveChanges(); } return(userRating); }
public void GetById_CorrectDataGot_ActualEqualsExpectedData() { var expectedUserRating = new UserRating { RaterUserID = 2, UserBeingRatedID = 1, Comment = "Alright", RatingID = 3 }; UserRating actualUserRating; using (var userRatingRepo = new UserRatingRepository(new brothershipEntities(ConnectionStrings.TEST_CONNECTION_STRING_NAME))) { actualUserRating = userRatingRepo.GetById(expectedUserRating.RaterUserID, expectedUserRating.UserBeingRatedID); } AssertUserRatingsEqual(expectedUserRating, actualUserRating); }
public TitleDataService() { var context = new ImdbContext(); _castInfo = new CastInfoRepository(context); _titles = new TitleRepository(context); _casts = new CastsRepository(context); _genre = new GenreRepository(context); _format = new FormatRepository(context); _userRating = new UserRatingRepository(context); _titleFormat = new TitleFormatRepository(context); _titleGenre = new TitleGenreRepository(context); _titleAlias = new TitleAliasRepository(context); _titleInfo = new TitleInfoRepository(context); _episodes = new GenericRepository <Episodes>(context); _comments = new CommentsRepository(context); _bookmarks = new BookmarkRepository(context); _flaggedComments = new FlaggedCommentsRepository(context); }
public void Update_WasRatingUpdated_ActualEqualsExpectedData() { var expectedUserRating = new UserRating { RaterUserID = 2, UserBeingRatedID = 1, Comment = "Winning", RatingID = 3 }; UserRating actualUserRating; using (var userRatingRepo = new UserRatingRepository(new brothershipEntities(ConnectionStrings.TEST_CONNECTION_STRING_NAME))) { userRatingRepo.Update(expectedUserRating); userRatingRepo.SaveChanges(); actualUserRating = userRatingRepo.GetById(expectedUserRating.RaterUserID, expectedUserRating.UserBeingRatedID); } AssertUserRatingsEqual(expectedUserRating, actualUserRating); }