public void LinqExcept_ShouldReturnEMotyCollection() { var playlistItem1 = new List<PlaylistItem> { new PlaylistItem { Snippet = new PlaylistItemSnippet { Title = "Title 1", ResourceId = new ResourceId { VideoId = "dsfhahdfh" } } } }; var playlistItem2 = new List<PlaylistItem> { new PlaylistItem { Snippet = new PlaylistItemSnippet { Title = "Title 1", ResourceId = new ResourceId { VideoId = "dsfhahdfh" } } } }; var comparer = new PlaylistItemEqualityComparer(); var result = playlistItem1.Except(playlistItem2, comparer); Assert.IsFalse(result.Any()); }
public void Equals_ShouldReturnTrue() { var playlistItem1 = new PlaylistItem { Snippet = new PlaylistItemSnippet { Title = "Title 1", ResourceId = new ResourceId { VideoId = "dsfhahdfh" } } }; var playlistItem2 = new PlaylistItem { Snippet = new PlaylistItemSnippet { Title = "Title 1", ResourceId = new ResourceId { VideoId = "dsfhahdfh" } } }; var comparer = new PlaylistItemEqualityComparer(); Assert.IsTrue(comparer.Equals(playlistItem1, playlistItem2)); Assert.AreEqual(comparer.GetHashCode(playlistItem1), comparer.GetHashCode(playlistItem2)); }