コード例 #1
0
            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);
            }
コード例 #2
0
            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")));
            }