public void Can_create_gist()
        {
            var gateway = new GitHubGateway(AccessToken);

            var gist = gateway.CreateGithubGist(
                description: "Hello World Examples",
                isPublic: true,
                textFiles: 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"));
        }
Example #2
0
 public GithubGist githubCreatePrivateGist(GitHubGateway gateway, string description, Dictionary <string, string> files) =>
 gateway.CreateGithubGist(description: description, isPublic: false, files: files);
Example #3
0
 public GithubGist githubCreateGist(GitHubGateway gateway, string description, Dictionary <string, string> files) =>
 gateway.CreateGithubGist(description: description, isPublic: true, textFiles: files);