예제 #1
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }