Beispiel #1
0
        public void YouTubeViewerPercentageDbWriteTest()
        {
            var someLakeVideos = new[] {
                new Video()
                {
                    VideoId = "xyz", Title = "The Population Boom", Duration = "PT5M11S"
                },
            };

            YDS.SomeVideosWereFound(someLakeVideos, "fee");

            APS.YouTubeVideoSyncJobHasRun();

            var someMetrics = new (string videoId, DateTime date, IEnumerable <ViewerPercentage> viewerPercentages)[] {
Beispiel #2
0
        public void YouTubeVideosInDataLakeAreTransformedIntoSourceVideos()
        {
            var channelId = "fee";

            var titleAtypo = "The True Mening of Patriotism";
            var titleA     = "The True Meaning of Patriotism";
            var titleB     = "The Population Boom";

            var someLakeVideos = new[] {
                new Video()
                {
                    VideoId = "xyz", Title = titleAtypo, Duration = "PT5M11S"
                },
                new Video()
                {
                    VideoId = "zxy", Title = titleB, Duration = "PT2M6S"
                },
            };

            YDS.SomeVideosWereFound(someLakeVideos, channelId);

            APS.YouTubeVideoSyncJobHasRun();

            using (var context = new DataLakeYouTubeDataContext()) {
                var videos = context.Videos.OrderBy(x => x.Title).ToList();
                var titles = new[] { titleB, titleAtypo };

                Assert.Equal(titles.Count(), videos.Count());
                for (var i = 0; i < titles.Count(); i++)
                {
                    Assert.Equal(titles[i], videos[i].Title);
                }
            }

            using (var context = new ApplicationDbContext()) {
                var videos = context.SourceVideos.OrderBy(x => x.Title).ToList();
                var titles = new[] { titleB, titleAtypo };

                Assert.Equal(titles.Count(), videos.Count());
                for (var i = 0; i < titles.Count(); i++)
                {
                    Assert.Equal(titles[i], videos[i].Title);
                }
            }

            someLakeVideos = new[] {
                new Video()
                {
                    VideoId = "xyz", Title = titleA, Duration = "PT5M11S"
                },
                new Video()
                {
                    VideoId = "zxy", Title = titleB, Duration = "PT2M6S"
                },
            };
            YDS.SomeVideosWereFound(someLakeVideos, channelId);

            APS.YouTubeVideoSyncJobHasRun();

            using (var context = new DataLakeYouTubeDataContext()) {
                var videos = context.Videos.OrderBy(x => x.Title).ToList();
                var titles = new[] { titleB, titleA, titleAtypo };

                Assert.Equal(titles.Count(), videos.Count());
                for (var i = 0; i < titles.Count(); i++)
                {
                    Assert.Equal(titles[i], videos[i].Title);
                }
            }

            using (var context = new ApplicationDbContext()) {
                var videos = context.SourceVideos.OrderBy(x => x.Title).ToList();
                var titles = new[] { titleB, titleA };

                Assert.Equal(titles.Count(), videos.Count());
                for (var i = 0; i < titles.Count(); i++)
                {
                    Assert.Equal(titles[i], videos[i].Title);
                }
            }
        }