示例#1
0
        public void InvalidData()
        {
            ApodModel apod = null;

            Assert.Throws <ArgumentNullException>(() => apod.ToUri());

            apod = new ApodModel();
            Assert.Throws <ArgumentNullException>(() => apod.ToUri());
        }
示例#2
0
        public static Uri ToUri(this ApodModel apod)
        {
            if (apod == null || apod.Url == null)
            {
                throw new ArgumentNullException("invalid APOD result");
            }

            return(apod.Url);
        }
示例#3
0
        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());
        }