Exemplo n.º 1
0
        public async Task AllVideos()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "AllVideos_Database")
                          .Options;
            var dbContext    = new ApplicationDbContext(options);
            var videoService = new VideoService(dbContext);

            await videoService.AddVideoAsync("https://www.youtube.com/watch?v=mjrOA8Qe38k", "TE AMO1", "COVER BY GABBY G1", "asdf1");

            await videoService.AddVideoAsync("https://www.youtube.com/watch?v=mjrOA8Qe38k", "TE AMO2", "COVER BY GABBY G2", "asdf2");

            var videoCount = await videoService.AllVideos().AllVideos.CountAsync();

            var video = videoService.AllVideos().AllVideos.ToList().First();

            Assert.Equal("https://www.youtube.com/watch?v=mjrOA8Qe38k", video.Link);
            Assert.Equal("TE AMO1", video.Title);
            Assert.Equal("COVER BY GABBY G1", video.Description);
            Assert.Equal(2, videoCount);
        }