public void RequestsCorrectUrlWithRepositoryId()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableReferencesClient(gitHubClient);

                client.Get(1, "heads/develop");

                gitHubClient.Received().Git.Reference.Get(1, "heads/develop");
            }
            public void RequestsCorrectUrl()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableReferencesClient(gitHubClient);

                client.GetAll("owner", "repo");

                gitHubClient.Received().Git.Reference.GetAll("owner", "repo");
            }
            public void EnsuresNonNullArguments()
            {
                var client = new ObservableReferencesClient(Substitute.For<IGitHubClient>());

                Assert.Throws<ArgumentNullException>(() => client.GetAll(null, "name"));
                Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", null));

                Assert.Throws<ArgumentException>(() => client.GetAll("", "name"));
                Assert.Throws<ArgumentException>(() => client.GetAll("owner", ""));
            }
            public void RequestsCorrectUrl()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableReferencesClient(gitHubClient);

                client.Delete("owner", "repo", "heads/develop");

                gitHubClient.Received().Git.Reference.Delete("owner", "repo", "heads/develop");
            }
            public void PostsToCorrectUrlWithRepositoryId()
            {
                var referenceUpdate = new ReferenceUpdate("sha");
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableReferencesClient(gitHubClient);

                client.Update(1, "heads/develop", referenceUpdate);

                gitHubClient.Received().Git.Reference.Update(1, "heads/develop", referenceUpdate);
            }
            public void EnsuresNonNullArguments()
            {
                var client = new ObservableReferencesClient(Substitute.For<IGitHubClient>());

                Assert.Throws<ArgumentNullException>(() => client.Update(null, "name", "heads/develop", new ReferenceUpdate("sha")));
                Assert.Throws<ArgumentNullException>(() => client.Update("owner", null, "heads/develop", new ReferenceUpdate("sha")));
                Assert.Throws<ArgumentNullException>(() => client.Update("owner", "name", null, new ReferenceUpdate("sha")));
                Assert.Throws<ArgumentNullException>(() => client.Update("owner", "name", "heads/develop", null));

                Assert.Throws<ArgumentNullException>(() => client.Update(1, null, new ReferenceUpdate("sha")));
                Assert.Throws<ArgumentNullException>(() => client.Update(1, "heads/develop", null));

                Assert.Throws<ArgumentException>(() => client.Update("", "name", "heads/develop", new ReferenceUpdate("sha")));
                Assert.Throws<ArgumentException>(() => client.Update("owner", "", "heads/develop", new ReferenceUpdate("sha")));
                Assert.Throws<ArgumentException>(() => client.Update("owner", "name", "", new ReferenceUpdate("sha")));

                Assert.Throws<ArgumentException>(() => client.Update(1, "", new ReferenceUpdate("sha")));
            }
            public void PostsToCorrectUrl()
            {
                var newReference = new NewReference("heads/develop", "sha");
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableReferencesClient(gitHubClient);

                client.Create("owner", "repo", newReference);

                gitHubClient.Received().Git.Reference.Create("owner", "repo", newReference);
            }