Beispiel #1
0
        public void MovieRemoverThrowsException()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.Throws <SpecificMovieException>(() => _specificMovieInfoService.MovieRemover(0));
        }
Beispiel #2
0
        public void UserPositonReturnsPosition()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.AreEqual("admin", _specificMovieInfoService.UserPositon(1));
        }
Beispiel #3
0
        public void CheckIfUserRatedPaseses()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.AreEqual(true, _specificMovieInfoService.CheckIfUserRated(1));
        }
Beispiel #4
0
        public void GetCommentsFromDBGetsTheComments()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.AreEqual(_mockedDummySpecificMovieRepository.comments, _specificMovieInfoService.GetCommentsFromDB());
        }
Beispiel #5
0
        public void GetMovieFromDBAndSetItInModelThrowsException()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.Throws <SpecificMovieException>(() => _specificMovieInfoService.GetMovieFromDBAndSetItInModel(0));
        }
Beispiel #6
0
        public void CheckIfUserHasMovieInWatchListThrowsException()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.Throws <SpecificMovieException>(() => _specificMovieInfoService.CheckIfUserHasMovieInWatchList(0));
        }
Beispiel #7
0
        public void SaveComentInDBThrowsException()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.Throws <SpecificMovieException>(() => _specificMovieInfoService.SaveComentInDB(0, "12123"));
        }
Beispiel #8
0
        public void GetCurrentUserUserNameThrowsException()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.Throws <SpecificMovieException>(() => _specificMovieInfoService.GetCurrentUserUserName(0));
        }
Beispiel #9
0
        public void GetLastCommentGetsTheLastComment()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.AreEqual(_mockedDummySpecificMovieRepository.comments.Last(), _specificMovieInfoService.GetLastComment(1));
        }
Beispiel #10
0
        public void AddRateThrowsException()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.Throws <SpecificMovieException>(() => _specificMovieInfoService.AddRate(1, -1));
        }
Beispiel #11
0
        public void GetCurrentUserUserNameReturnsUserName()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.AreEqual("Peshko", _specificMovieInfoService.GetCurrentUserUserName(1));
        }
Beispiel #12
0
        public void DeleteCommentThrowsException()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.Throws <SpecificMovieException>(() => _specificMovieInfoService.DeleteComment(new List <int>()));
        }
Beispiel #13
0
        public void SetUpdatedRateInModelThrowsException()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.Throws <SpecificMovieException>(() => _specificMovieInfoService.SetUpdatedRateInModel());
        }
Beispiel #14
0
        public void GetUserRateReturnsRate()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.AreEqual(5, _specificMovieInfoService.GetUserRate(1));
        }
Beispiel #15
0
        public void GetLastCommentGetsTheLastCommentThrowsException()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            Assert.Throws <SpecificMovieException>(() => _specificMovieInfoService.GetLastComment(0));
        }
Beispiel #16
0
        public void MovieAdderAdds()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            _specificMovieInfoService.MovieAdder(1);
            Assert.AreEqual(4, _mockedDummySpecificMovieRepository.watchlist.Count);
        }
Beispiel #17
0
        public void GetMovieFromDBAndSetItInModelPaseses()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            _specificMovieInfoService.GetMovieFromDBAndSetItInModel(1);
            Assert.AreEqual("Transformers", _specificMovieInfoService.SetMovieInfo().title);
        }
Beispiel #18
0
        public void AddRateAdds()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            _specificMovieInfoService.AddRate(1, 4);
            Assert.AreEqual(4, _mockedDummySpecificMovieRepository.currentMovie.AVGRating);
        }
Beispiel #19
0
        public void SaveComentInDBSavesTheComment()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            _specificMovieInfoService.SaveComentInDB(1, "12123");
            Assert.AreEqual(3, _mockedDummySpecificMovieRepository.comments.Count);
        }
Beispiel #20
0
        public void SetMovieInfoThrowsException()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            _mockedDummySpecificMovieRepository.error = true;
            Assert.Throws <Exception>(() => _specificMovieInfoService.SetMovieInfo());
        }
Beispiel #21
0
        public void SetUpdatedRateInModelPaseses()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            _specificMovieInfoService.GetMovieFromDBAndSetItInModel(1);
            _specificMovieInfoService.SetUpdatedRateInModel();
            Assert.AreEqual(5, _specificMovieInfoService.SetMovieInfo().avgRating);
        }
Beispiel #22
0
        public void MovieRemoverRemoves()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            _specificMovieInfoService.GetMovieFromDBAndSetItInModel(1);
            _specificMovieInfoService.MovieRemover(1);
            Assert.AreEqual(2, _mockedDummySpecificMovieRepository.watchlist.Count);
        }
Beispiel #23
0
        public void DeleteUserRateDeletesRate()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            _specificMovieInfoService.GetMovieFromDBAndSetItInModel(1);
            _specificMovieInfoService.DeleteUserRate(1);
            Assert.AreEqual(4.5, _mockedDummySpecificMovieRepository.currentMovie.AVGRating);
        }
Beispiel #24
0
        public void DeleteCommentDeletes()
        {
            MockedDummySpecificMovieRepository _mockedDummySpecificMovieRepository = new MockedDummySpecificMovieRepository();
            ISpecificMovieInfoService          _specificMovieInfoService           = new SpecificMovieInfoService(_mockedDummySpecificMovieRepository._specificMovieInfoRepository);

            _specificMovieInfoService.DeleteComment(new List <int>()
            {
                1
            });
            Assert.AreEqual(1, _mockedDummySpecificMovieRepository.comments.Count);
        }