Esempio n. 1
0
        public void ThrowArgumentExceptionWhenParamterIdIsNotNumber()
        {
            var    mockedMovieRepo = new Mock <IRepository <Movie> >();
            string stringId        = "abc";

            var actualMoviesService =
                new Cinema.Data.Services.MoviesService(mockedMovieRepo.Object);

            Assert.That(
                () => actualMoviesService.GetById(stringId), Throws.ArgumentException);
        }
Esempio n. 2
0
        public void CallMoviesRepoGetByIdMethodWithSameParamterId()
        {
            var    mockedMovieRepo = new Mock <IRepository <Movie> >();
            string stringId        = "1";
            int    intId           = 1;

            var actualMoviesService =
                new Cinema.Data.Services.MoviesService(mockedMovieRepo.Object);

            actualMoviesService.GetById(stringId);

            mockedMovieRepo.Verify(service => service.GetById(intId), Times.Once);
        }