Пример #1
0
        public void UploadTheGistToGitHub()
        {
            var gitHubSender = new MockGitHubSender();
            var gistApi = new UploadsGists { GitHubSender = gitHubSender };

            gistApi.Upload("file3.cs", "My oh my");

            gitHubSender.SentAGist.Should().Be.True();
        }
Пример #2
0
        public void UploadTheGistToGitHub()
        {
            var gitHubSender = new MockGitHubSender();
            var gistApi      = new UploadsGists {
                GitHubSender = gitHubSender
            };

            gistApi.Upload("file3.cs", "My oh my", "description", false);

            gitHubSender.SentAGist.Should().Be.True();
        }
Пример #3
0
        public void GistUrlWillBeAvaible()
        {
            string actualUrl = null;

            var gitHubSender = new MockGitHubSender() { ResultingUrl = "http://gist.github.com/123" };
            var gistApi = new UploadsGists { GitHubSender = gitHubSender };

            gistApi.Uploaded = url => actualUrl = url;
            gistApi.Upload("file3.cs", "My oh my");

            actualUrl.Should().Equal("http://gist.github.com/123");
        }
Пример #4
0
        public void WillBeSentWithAppliedCredentials()
        {
            var gitHubSender = new MockGitHubSender();

            var uploads = new UploadsGists { GitHubSender = gitHubSender };

            var credentials = new GitHubUserCredentials("something", "secret");
            uploads.UseCredentials(credentials);

            uploads.Upload("file4.cs", "gee wizz");

            gitHubSender.LastCredentialsApplied.Should().Equal(credentials);
        }
Пример #5
0
        public void WillAllowUsToGetInvolvedWhenCredentialsAreBad()
        {
            var sender = new MockGitHubSender();
            sender.FailWith("Blah");

            var uploads = new UploadsGists();
            uploads.GitHubSender = sender;

            var didTellUs = false;
            uploads.CredentialsAreBad = () => didTellUs = true;

            uploads.Upload("asdf", "asdF");

            didTellUs.Should().Be.True();
        }
Пример #6
0
        public void WillBeSentWithAppliedCredentials()
        {
            var gitHubSender = new MockGitHubSender();

            var uploads = new UploadsGists {
                GitHubSender = gitHubSender
            };

            var credentials = new GitHubUserCredentials("something", "secret");

            uploads.UseCredentials(credentials);

            uploads.Upload("file4.cs", "gee wizz", "desc", false);

            gitHubSender.LastCredentialsApplied.Should().Equal(credentials);
        }
Пример #7
0
        public void GistUrlWillBeAvaible()
        {
            string actualUrl = null;

            var gitHubSender = new MockGitHubSender()
            {
                ResultingUrl = "http://gist.github.com/123"
            };
            var gistApi = new UploadsGists {
                GitHubSender = gitHubSender
            };

            gistApi.Uploaded = url => actualUrl = url;
            gistApi.Upload("file3.cs", "My oh my", "descr", false);

            actualUrl.Should().Equal("http://gist.github.com/123");
        }
Пример #8
0
        public void WillAllowUsToGetInvolvedWhenCredentialsAreBad()
        {
            var sender = new MockGitHubSender();

            sender.FailWith("Blah");

            var uploads = new UploadsGists();

            uploads.GitHubSender = sender;

            var didTellUs = false;

            uploads.CredentialsAreBad = () => didTellUs = true;

            uploads.Upload("asdf", "asdF", "desc", false);

            didTellUs.Should().Be.True();
        }