コード例 #1
0
            public void CallsIntoClient()
            {
                var github = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(github);
                var update = new RepositoryUpdate();

                client.Edit("owner", "repo", update);

                github.Repository.Received(1).Edit("owner", "repo", update);
            }
コード例 #2
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());
                var update = new RepositoryUpdate();

                Assert.Throws<ArgumentNullException>(() => client.Edit(null, "repo", update));
                Assert.Throws<ArgumentNullException>(() => client.Edit("owner", null, update));
                Assert.Throws<ArgumentNullException>(() => client.Edit("owner", "repo", null));

                Assert.Throws<ArgumentNullException>(() => client.Edit(1, null));

                Assert.Throws<ArgumentException>(() => client.Edit("", "repo", update));
                Assert.Throws<ArgumentException>(() => client.Edit("owner", "", update));
            }
コード例 #3
0
            public async Task EnsuresArguments()
            {
                var github = Substitute.For<IGitHubClient>();
                var nonreactiveClient = new RepositoriesClient(Substitute.For<IApiConnection>());
                github.Repository.Returns(nonreactiveClient);
                var client = new ObservableRepositoriesClient(github);
                var update = new RepositoryUpdate();

                Assert.Throws<ArgumentNullException>(() => client.Edit(null, "repo", update));
                Assert.Throws<ArgumentNullException>(() => client.Edit("owner", null, update));
                Assert.Throws<ArgumentNullException>(() => client.Edit("owner", "repo", null));
                Assert.Throws<ArgumentException>(() => client.Edit("", "repo", update));
                Assert.Throws<ArgumentException>(() => client.Edit("owner", "", update));
            }
コード例 #4
0
            public void PatchsTheCorrectUrlWithRepositoryId()
            {
                var github = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(github);
                var update = new RepositoryUpdate();

                client.Edit(1, update);

                github.Repository.Received(1).Edit(1, update);
            }