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