/// <summary> /// Deletes the specified <see cref="ReleaseAsset"/> from the specified repository /// </summary> /// <remarks> /// See the <a href="http://developer.github.com/v3/repos/releases/#delete-a-release-asset">API documentation</a> for more information. /// </remarks> /// <param name="owner">The repository's owner</param> /// <param name="name">The repository's name</param> /// <param name="id">The id of the <see cref="ReleaseAsset"/>.</param> public IObservable <Unit> DeleteAsset(string owner, string name, int id) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); return(_client.DeleteAsset(owner, name, id).ToObservable()); }
public async Task CanDeleteAsset() { var releaseWithNoUpdate = new NewRelease("0.1") { Draft = true }; var release = await _releaseClient.Create(_context.RepositoryOwner, _context.RepositoryName, releaseWithNoUpdate); var stream = Helper.LoadFixture("hello-world.txt"); var newAsset = new ReleaseAssetUpload("hello-world.txt", "text/plain", stream, null); var result = await _releaseClient.UploadAsset(release, newAsset); var asset = await _releaseClient.GetAsset(_context.RepositoryOwner, _context.RepositoryName, result.Id); Assert.NotNull(asset); await _releaseClient.DeleteAsset(_context.RepositoryOwner, _context.RepositoryName, result.Id); await Assert.ThrowsAsync <NotFoundException>(async() => await _releaseClient.GetAsset(_context.RepositoryOwner, _context.RepositoryName, result.Id)); }