public void Test_ParseUrl_Null(string url) { // Validate parameters. if (string.IsNullOrWhiteSpace(url)) { throw new ArgumentNullException(nameof(url)); } // Parse the URL. ParsedUrl?actual = YouTubeExtensions.ParseUrl(url); // Null. Assert.Null(actual); }
public void Test_ParseUrl_NonNull(string url, string?videoId, string?playlistId, bool isShortUrl) { // Validate parameters. if (string.IsNullOrWhiteSpace(url)) { throw new ArgumentNullException(nameof(url)); } // Parse the URL. ParsedUrl?actual = YouTubeExtensions.ParseUrl(url); // Not null. Assert.NotNull(actual); // Assert. Assert.Equal(videoId, actual !.VideoId); Assert.Equal(playlistId, actual !.PlaylistId); Assert.Equal(isShortUrl, actual !.IsShortUrl); }