public void GetMoviesCountShouldReturn0() { var repository = new Mock <IDeletableEntityRepository <Movie> >(); var service = new MoviesService(repository.Object); Assert.Equal(0, service.GetMoviesCount()); repository.Verify(x => x.All(), Times.Once); }
public async Task GetMoviesCount_WithValidInput_ShouldReturnValidResult() { var dbContext = ApplicationDbContextCreatorInMemory.InitializeContext(); await this.SeedData(dbContext); var moviesRepository = new EfDeletableEntityRepository <Movie>(dbContext); var genresRepository = new EfDeletableEntityRepository <Genre>(dbContext); var service = new MoviesService(moviesRepository, genresRepository); var result = service.GetMoviesCount(); Assert.Equal(2, result); }
public void GetMoviesCountShouldReturn3() { var repository = new Mock <IDeletableEntityRepository <Movie> >(); repository.Setup(r => r.All()).Returns(new List <Movie> { new Movie(), new Movie(), new Movie(), }.AsQueryable()); var service = new MoviesService(repository.Object); Assert.Equal(3, service.GetMoviesCount()); repository.Verify(x => x.All(), Times.Once); }