public void AsIndexEndpointUrl_Should_Return_Valid_IndexUri( [Values("topstories", "newstories", "beststories")] string endpointName) { var endpoint = new RestApiConfig(); var indexUrl = endpoint.AsIndexEndpointUrl(endpointName); Assert.AreEqual(indexUrl.AbsoluteUri, $"https://hacker-news.firebaseio.com/v0/{endpointName}.json"); }
public void AsIndexEndpointUrl_With_Null_ApiVersion_Should_Throw_ArgumentNullException() { var endpoint = new RestApiConfig { ApiVersion = null }; ArgumentNullException ex = Assert.Throws <ArgumentNullException>( delegate { endpoint.AsIndexEndpointUrl("topstories"); }); Assert.That(ex.ParamName, Is.EqualTo(nameof(endpoint.ApiVersion))); }
public void AsIndexEndpointUrl_With_Null_BaseUri_Should_Throw_ArgumentNullException() { var endpoint = new RestApiConfig { BaseUri = null }; ArgumentNullException ex = Assert.Throws <ArgumentNullException>( delegate { endpoint.AsIndexEndpointUrl("test"); }); Assert.That(ex.ParamName, Is.EqualTo(nameof(endpoint.BaseUri))); }