public async Task EnsuresNonNullArguments() { var releasesClient = new ReleasesClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentNullException>(() => releasesClient.Get(null, "name", 1)); await Assert.ThrowsAsync<ArgumentException>(() => releasesClient.Get("", "name", 1)); await Assert.ThrowsAsync<ArgumentNullException>(() => releasesClient.Get("owner", null, 1)); await Assert.ThrowsAsync<ArgumentException>(() => releasesClient.Get("owner", "", 1)); }
public void EnsuresNonNullArguments() { var releasesClient = new ReleasesClient(Substitute.For <IApiConnection>()); Assert.Throws <ArgumentNullException>(() => releasesClient.Get(null, "name", 1)); Assert.Throws <ArgumentException>(() => releasesClient.Get("", "name", 1)); Assert.Throws <ArgumentNullException>(() => releasesClient.Get("owner", null, 1)); Assert.Throws <ArgumentException>(() => releasesClient.Get("owner", "", 1)); }
public async Task RequestsTheCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new ReleasesClient(connection); await client.Get("fake", "repo", 1); connection.Received().Get <Release>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/releases/1")); }
public void RequestsTheCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new ReleasesClient(connection); client.Get("fake", "repo", 1); connection.Received().Get<Release>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/releases/1")); }
public async Task RequestsTheCorrectUrlWithRepositoryIdByTag() { var connection = Substitute.For <IApiConnection>(); var client = new ReleasesClient(connection); await client.Get(1, "tag"); connection.Received().Get <Release>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/releases/tags/tag")); }
public async Task RequestsTheCorrectUrlWithRepositoryId() { var connection = Substitute.For<IApiConnection>(); var client = new ReleasesClient(connection); await client.Get(1, 1); connection.Received().Get<Release>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/releases/1")); }
public async Task EnsuresNonNullArguments() { var releasesClient = new ReleasesClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => releasesClient.Get(null, "name", 1)); await Assert.ThrowsAsync <ArgumentNullException>(() => releasesClient.Get("owner", null, 1)); await Assert.ThrowsAsync <ArgumentException>(() => releasesClient.Get("", "name", 1)); await Assert.ThrowsAsync <ArgumentException>(() => releasesClient.Get("owner", "", 1)); await Assert.ThrowsAsync <ArgumentNullException>(() => releasesClient.Get("owner", "name", null)); await Assert.ThrowsAsync <ArgumentException>(() => releasesClient.Get("owner", "name", "")); await Assert.ThrowsAsync <ArgumentNullException>(() => releasesClient.Get(null, "name", "tag")); await Assert.ThrowsAsync <ArgumentException>(() => releasesClient.Get("", "name", "tag")); await Assert.ThrowsAsync <ArgumentNullException>(() => releasesClient.Get("owner", null, "tag")); await Assert.ThrowsAsync <ArgumentException>(() => releasesClient.Get("owner", "", "tag")); await Assert.ThrowsAsync <ArgumentNullException>(() => releasesClient.Get(1, null)); await Assert.ThrowsAsync <ArgumentException>(() => releasesClient.Get(1, "")); }