Exemplo n.º 1
0
            public async Task EnsuresNonEmptyArguments()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new EnterpriseManagementConsoleClient(connection);

                await Assert.ThrowsAsync <ArgumentException>(() => client.EditMaintenanceMode(new UpdateMaintenanceRequest(), ""));
            }
Exemplo n.º 2
0
            public async Task EnsuresNonNullArguments()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new EnterpriseManagementConsoleClient(connection);

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetMaintenanceMode(null));
            }
Exemplo n.º 3
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);
     Ldap                  = new EnterpriseLdapClient(apiConnection);
     License               = new EnterpriseLicenseClient(apiConnection);
     ManagementConsole     = new EnterpriseManagementConsoleClient(apiConnection);
     Organization          = new EnterpriseOrganizationClient(apiConnection);
     SearchIndexing        = new EnterpriseSearchIndexingClient(apiConnection);
     PreReceiveEnvironment = new EnterprisePreReceiveEnvironmentsClient(apiConnection);
 }
Exemplo n.º 4
0
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new EnterpriseManagementConsoleClient(connection);

                string expectedUri = "setup/api/maintenance?api_key=Password01";

                client.GetMaintenanceMode("Password01");

                connection.Received().Get <MaintenanceModeResponse>(Arg.Is <Uri>(u => u.ToString() == expectedUri));
            }
Exemplo n.º 5
0
            public void PassesRequestObject()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new EnterpriseManagementConsoleClient(connection);

                client.EditMaintenanceMode(new UpdateMaintenanceRequest(new UpdateMaintenanceRequestDetails(true)), "Password01");

                connection.Received().Post <MaintenanceModeResponse>(
                    Arg.Any <Uri>(),
                    Arg.Is <string>(a =>
                                    a == "maintenance={\"enabled\":true,\"when\":\"now\"}"));
            }