Ejemplo n.º 1
0
 /// <summary>
 /// Instantiates a new GitHub Enterprise API client.
 /// </summary>
 /// <param name="apiConnection">An API connection</param>
 public EnterpriseClient(IApiConnection apiConnection) : base(apiConnection)
 {
     AdminStats = new EnterpriseAdminStatsClient(apiConnection);
     License = new EnterpriseLicenseClient(apiConnection);
     Organization = new EnterpriseOrganizationClient(apiConnection);
     SearchIndexing = new EnterpriseSearchIndexingClient(apiConnection);
 }
            public async Task EnsuresNonNullArguments()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new EnterpriseSearchIndexingClient(connection);

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Queue(null));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Queue("org", null));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Queue(null, "repo"));
            }
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new EnterpriseSearchIndexingClient(connection);

                string expectedUri = "staff/indexing_jobs";
                client.QueueAll("org");

                connection.Received().Post<SearchIndexingResponse>(Arg.Is<Uri>(u => u.ToString() == expectedUri), Arg.Any<object>());
            }
            public async Task EnsuresNonNullArguments()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new EnterpriseSearchIndexingClient(connection);

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.QueueAllIssues(null));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.QueueAllIssues("org", null));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.QueueAllIssues(null, "repo"));
            }
Ejemplo n.º 5
0
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new EnterpriseSearchIndexingClient(connection);

                string expectedUri = "staff/indexing_jobs";

                client.QueueAll("org");

                connection.Received().Post <SearchIndexingResponse>(Arg.Is <Uri>(u => u.ToString() == expectedUri), Arg.Any <object>());
            }
            public void PassesRequestObject()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new EnterpriseSearchIndexingClient(connection);

                client.QueueAll("org");
                connection.Received().Post <SearchIndexingResponse>(
                    Arg.Any <Uri>(),
                    Arg.Is <SearchIndexTarget>(t =>
                                               t.Target == "org/*"
                                               ));
            }
            public void PassesRequestObject()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new EnterpriseSearchIndexingClient(connection);

                client.QueueAll("org");
                connection.Received().Post<SearchIndexingResponse>(
                    Arg.Any<Uri>(),
                    Arg.Is<SearchIndexTarget>(t =>
                        t.Target == "org/*"
                        ));
            }