Beispiel #1
0
    public async Task CanCreateEditAndDeleteAGist()
    {
        var newGist = new NewGist {
            Description = "my new gist", Public = true
        };

        newGist.Files.Add("myGistTestFile.cs", "new GistsClient(connection).Create();");

        var createdGist = await _fixture.Create(newGist);

        Assert.NotNull(createdGist);
        Assert.Equal(newGist.Description, createdGist.Description);
        Assert.Equal(newGist.Public, createdGist.Public);

        var gistUpdate = new GistUpdate {
            Description = "my newly updated gist"
        };
        var gistFileUpdate = new GistFileUpdate
        {
            NewFileName = "myNewGistTestFile.cs",
            Content     = "new GistsClient(connection).Edit();"
        };

        gistUpdate.Files.Add("myGistTestFile.cs", gistFileUpdate);

        var updatedGist = await _fixture.Edit(createdGist.Id, gistUpdate);

        Assert.NotNull(updatedGist);
        Assert.Equal(updatedGist.Description, gistUpdate.Description);

        await _fixture.Delete(createdGist.Id);
    }
        /// <summary>
        /// Deletes a gist
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/gists/#delete-a-gist
        /// </remarks>
        /// <param name="id">The id of the gist</param>
        public IObservable <Unit> Delete(string id)
        {
            Ensure.ArgumentNotNull(id, nameof(id));

            return(_client.Delete(id).ToObservable());
        }
 public async Task DeleteGistAsync(string gistId)
 {
     await gistClient.Delete(gistId);
 }