public void RequestsTheCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReleasesClient(gitHubClient); var data = new ReleaseAssetUpdate("asset"); client.EditAsset("fake", "repo", 1, data); gitHubClient.Repository.Release.Received(1).EditAsset("fake", "repo", 1, data); }
public void EnsuresNonNullArguments() { var client = new ObservableReleasesClient(Substitute.For<IGitHubClient>()); Assert.Throws<ArgumentNullException>(() => client.EditAsset(null, "name", 1, new ReleaseAssetUpdate("name"))); Assert.Throws<ArgumentException>(() => client.EditAsset("", "name", 1, new ReleaseAssetUpdate("name"))); Assert.Throws<ArgumentNullException>(() => client.EditAsset("owner", null, 1, new ReleaseAssetUpdate("name"))); Assert.Throws<ArgumentException>(() => client.EditAsset("owner", "", 1, new ReleaseAssetUpdate("name"))); Assert.Throws<ArgumentNullException>(() => client.EditAsset("owner", "name", 1, null)); }
public void RequestsTheCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReleasesClient(gitHubClient); var data = new ReleaseAssetUpdate("asset"); client.EditAsset("fake", "repo", 1, 1, data); gitHubClient.Connection.PatchAsync<ReleaseAsset>( new Uri("repos/fake/repo/releases/1/assets/1", UriKind.Relative), data); }