public async Task GetCorrectThumbnailLink() { var videoList = new List <Video>(); var videoRepo = new Mock <IDeletableEntityRepository <Video> >(); videoRepo.Setup(x => x.All()).Returns(videoList.AsQueryable()); videoRepo.Setup(x => x.AddAsync(It.IsAny <Video>())) .Callback((Video r) => videoList.Add(r)); var videoService = new VideosService(videoRepo.Object); await videoService.CreateAsync(test.Title, test.Description, test.VideoUrl, test.Category); await videoService.CreateAsync(test2.Title, test2.Description, test2.VideoUrl, test2.Category); var embededLink = videoService.GetThumbnailLink(test.VideoUrl); var embededLink2 = videoService.GetThumbnailLink(test2.VideoUrl); Assert.Equal("https://i.ytimg.com/vi/w2ze3Z6BAmg/0.jpg", embededLink); Assert.Equal("https://i.ytimg.com/vi/03ILbXdE8b4/0.jpg", embededLink2); }