public void Can_create_gist() { var gateway = new GithubGateway(AccessToken); var gist = gateway.CreateGithubGist( description: "Hello World Examples", isPublic: true, files: new Dictionary <string, string> { ["hello_world_ruby.txt"] = "Run `ruby hello_world.rb` to print Hello World", ["hello_world_python.txt"] = "Run `python hello_world.py` to print Hello World", }); gist.PrintDump(); Assert.That(gist.Owner.Login, Is.EqualTo("gistlyn")); Assert.That(gist.Owner.Url, Is.EqualTo("https://api.github.com/users/gistlyn")); Assert.That(gist.Owner.Html_Url, Is.EqualTo("https://github.com/gistlyn")); var file = gist.Files["hello_world_ruby.txt"]; Assert.That(file.Filename, Is.EqualTo("hello_world_ruby.txt")); Assert.That(file.Type, Is.EqualTo("text/plain")); Assert.That(file.Language, Is.EqualTo("Text")); Assert.That(file.Raw_Url, Does.EndWith("/hello_world_ruby.txt")); Assert.That(file.Size, Is.GreaterThan(0)); Assert.That(file.Content, Does.Contain("Run `ruby hello_world.rb` to print Hello World")); file = gist.Files["hello_world_python.txt"]; Assert.That(file.Filename, Is.EqualTo("hello_world_python.txt")); Assert.That(file.Type, Is.EqualTo("text/plain")); Assert.That(file.Language, Is.EqualTo("Text")); Assert.That(file.Raw_Url, Does.EndWith("/hello_world_python.txt")); Assert.That(file.Size, Is.GreaterThan(0)); Assert.That(file.Content, Does.Contain("Run `python hello_world.py` to print Hello World")); }
public void Can_download_public_gist() { var gateway = new GithubGateway(); var result = gateway.GetGist(GistId); var gist = (GithubGist)result; Assert.That(gist.Owner.Login, Is.EqualTo("gistlyn")); Assert.That(gist.Owner.Url, Is.EqualTo("https://api.github.com/users/gistlyn")); Assert.That(gist.Owner.Html_Url, Is.EqualTo("https://github.com/gistlyn")); var file = gist.Files["main.cs"]; Assert.That(file.Filename, Is.EqualTo("main.cs")); Assert.That(file.Type, Is.EqualTo("text/plain")); Assert.That(file.Language, Is.EqualTo("C#")); Assert.That(file.Raw_Url, Does.EndWith("/main.cs")); Assert.That(file.Size, Is.GreaterThan(0)); Assert.That(file.Content, Does.Contain("Hello, {name}!")); }
public void Can_add_and_delete_gist_file() { var gateway = new GithubGateway(AccessToken); var newFile = "new.txt"; gateway.WriteGistFile(GistId, newFile, "this is a new file"); var gist = gateway.GetGist(GistId); var file = gist.Files[newFile]; Assert.That(file.Filename, Is.EqualTo(newFile)); Assert.That(file.Type, Is.EqualTo("text/plain")); Assert.That(file.Content, Is.EqualTo("this is a new file")); gateway.DeleteGistFiles(GistId, newFile); gist = gateway.GetGist(GistId); Assert.That(gist.Files.TryGetValue(newFile, out file), Is.False); }
public IgnoreResult githuDeleteGistFiles(GithubGateway gateway, string gistId, string filePath) { gateway.DeleteGistFiles(gistId, filePath); return(IgnoreResult.Value); }
public IgnoreResult githuDeleteGistFiles(GithubGateway gateway, string gistId, IEnumerable <string> filePaths) { gateway.DeleteGistFiles(gistId, filePaths.ToArray()); return(IgnoreResult.Value); }
public IgnoreResult githubWriteGistFiles(GithubGateway gateway, string gistId, Dictionary <string, string> gistFiles) { gateway.WriteGistFiles(gistId, gistFiles); return(IgnoreResult.Value); }
public IgnoreResult githubWriteGistFile(GithubGateway gateway, string gistId, string filePath, string contents) { gateway.WriteGistFile(gistId, filePath, contents); return(IgnoreResult.Value); }
public GithubGist githubCreatePrivateGist(GithubGateway gateway, string description, Dictionary <string, string> files) => gateway.CreateGithubGist(description: description, isPublic: false, files: files);
public GithubGist githubGist(GithubGateway gateway, string gistId) => gateway.GetGithubGist(gistId);
public List <GithubRepo> githubOrgRepos(GithubGateway gateway, string githubOrg) => gateway.GetOrgRepos(githubOrg);
public List <GithubRepo> githubUserRepos(GithubGateway gateway, string githubUser) => gateway.GetUserRepos(githubUser);
public Task <object> githubUserAndOrgRepos(GithubGateway gateway, string githubOrgOrUser) => Task.FromResult <object>(gateway.GetUserAndOrgReposAsync(githubOrgOrUser));
public Task <object> githubSourceRepos(GithubGateway gateway, string orgName) => Task.FromResult <object>(gateway.GetSourceReposAsync(orgName));
public string githubSourceZipUrl(GithubGateway gateway, string orgNames, string name) => gateway.GetSourceZipUrl(orgNames, name);