public void InvalidData() { ApodModel apod = null; Assert.Throws <ArgumentNullException>(() => apod.ToUri()); apod = new ApodModel(); Assert.Throws <ArgumentNullException>(() => apod.ToUri()); }
public static Uri ToUri(this ApodModel apod) { if (apod == null || apod.Url == null) { throw new ArgumentNullException("invalid APOD result"); } return(apod.Url); }
public void UrlTest() { var expected = new Uri("http://nasa.gov"); var actual = new ApodModel() { Url = new Uri("http://nasa.gov") }; Assert.Equal(expected, actual.ToUri()); }