Ejemplo n.º 1
0
        public async Task CreateGistFileAsync(string gistId, string fileName, string fileContent)
        {
            var update = new GistUpdate();

            update.Files.Add(fileName, new GistFileUpdate {
                Content = fileContent, NewFileName = fileName
            });
            await gistClient.Edit(gistId, update);
        }
Ejemplo n.º 2
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);
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Edits a gist
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/gists/#delete-a-gist
        /// </remarks>
        /// <param name="id">The id of the gist</param>
        /// <param name="gistUpdate">The update to the gist</param>
        public IObservable <Gist> Edit(string id, GistUpdate gistUpdate)
        {
            Ensure.ArgumentNotNull(id, nameof(id));
            Ensure.ArgumentNotNull(gistUpdate, nameof(gistUpdate));

            return(_client.Edit(id, gistUpdate).ToObservable());
        }