In one of the sections I encountered a problem, this one:
public string GetUnprocessedVideosAsCsvRefactoredVersion()
{
var videoIds = new List<int>();
var videos = _videoRepository.GetUnprocessedVideos();
foreach (var v in videos)
videoIds.Add(v.Id);
return String.Join(",", videoIds);
}
In VideoRepository class, we know that only videos whose isProcessed variable is false should be added to the list. But the unit test written by Mosh does not work, meaning that the logic behind it is wrong. Am I right? Can you enlighten me please?
I mean if we initialize a list like this:
var videos = new List<Video>()
{
new Video{Id = 1, Title= "Shrek", IsProcessed = false},
new Video{Id = 2, Title= "StarWars", IsProcessed = false},
new Video{Id = 3, Title= "Separation", IsProcessed = true},
new Video{Id = 4, Title= "PulpFiction", IsProcessed = false},
new Video{Id = 5, Title= "FightClub", IsProcessed = false},
new Video{Id = 6, Title= "Fountain", IsProcessed = true},
};
The method should only filter 1,2,4, and 5 but it returns all of them.