Esempio n. 1
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));
            }
Esempio n. 2
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);
            }
            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);
            }
Esempio n. 4
0
            public void PatchsTheCorrectUrl()
            {
                var github = Substitute.For <IGitHubClient>();
                var client = new ObservableRepositoriesClient(github);
                var update = new RepositoryUpdate("anyreponame");

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

                github.Repository.Received(1).Edit("owner", "repo", update);
            }
            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));
            }