public void GetApodUri_CorrectBaseUri(string apiKey, string baseUri, string expected) { var uriBuilder = new ApodUriBuilder(apiKey, baseUri); var actual = uriBuilder.GetApodUri(); Assert.Equal(expected, actual); }
public void GetApodUri_Count_CorrectUri(int count, string expected) { var uriBuilder = new ApodUriBuilder("exampleKey"); var actual = uriBuilder.GetApodUri(count); Assert.Equal(expected, actual); }
public void GetApodUri_Today_CorrectUri() { var uriBuilder = new ApodUriBuilder("1234567890"); var expected = "https://api.nasa.gov/planetary/apod?api_key=1234567890"; var actual = uriBuilder.GetApodUri(); Assert.Equal(expected, actual); }
public void GetApodUri_Date_CorrectCustomDateFormat(string dateFormat, string expected) { var date = new DateTime(2014, 01, 28); var uriBuilder = new ApodUriBuilder("exampleKey", dateFormat: dateFormat); var actual = uriBuilder.GetApodUri(date); Assert.Equal(expected, actual); }
public void GetApodUri_DateRange_CorrectCustomDateFormat(string dateFormat, string expected) { var startDate = new DateTime(2000, 12, 29); var endDate = new DateTime(2001, 01, 04); var uriBuilder = new ApodUriBuilder("exampleKey", dateFormat: dateFormat); var actual = uriBuilder.GetApodUri(startDate, endDate); Assert.Equal(expected, actual); }
public void GetApodUri_Date_CorrectUri() { var date = new DateTime(2018, 05, 09); var uriBuilder = new ApodUriBuilder("exampleKey"); var expected = "https://api.nasa.gov/planetary/apod?api_key=exampleKey&date=2018-05-09"; var actual = uriBuilder.GetApodUri(date); Assert.Equal(expected, actual); }
public void GetApodUri_DateRange_CorrectUri() { var startDate = new DateTime(1998, 03, 24); var endDate = new DateTime(1998, 04, 02); var uriBuilder = new ApodUriBuilder("exampleKey"); var expected = "https://api.nasa.gov/planetary/apod?api_key=exampleKey&start_date=1998-03-24&end_date=1998-04-02"; var actual = uriBuilder.GetApodUri(startDate, endDate); Assert.Equal(expected, actual); }
public void GetApodUri_DateRange_DefaultEndDate_CorrectUri() { var startDate = new DateTime(2019, 10, 29); var uriBuilder = new ApodUriBuilder("exampleKey"); var expected = "https://api.nasa.gov/planetary/apod?api_key=exampleKey&start_date=2019-10-29"; var actual = uriBuilder.GetApodUri(startDate: startDate); Assert.Equal(expected, actual); }
public void GetApodUri_SameResultEveryTime() { var uriBuilder = new ApodUriBuilder("exampleKey"); var expected = "https://api.nasa.gov/planetary/apod?api_key=exampleKey"; // Run 3 times and make sure the result doesn't change for (int i = 0; i < 3; i++) { var actual = uriBuilder.GetApodUri(); Assert.Equal(expected, actual); } }