public void ForceBuildWithParametersSendsRequest() { var client = new CruiseServerClient( new ServerStub("ForceBuild", typeof(BuildIntegrationRequest), "Project #1")); var parameters = new List<NameValuePair>(); client.ForceBuild("Project #1", parameters); }
public void DiagnoseSecurityPermissions() { DiagnoseSecurityResponse response = new DiagnoseSecurityResponse(); response.Result = ResponseResult.Success; CruiseServerClient client = new CruiseServerClient( new ServerStub("DiagnoseSecurityPermissions", typeof(DiagnoseSecurityRequest), null, response)); client.DiagnoseSecurityPermissions("johnDoe"); }
public void GetProjectStatusSendsRequest() { ProjectStatus status = new ProjectStatus("Test project", IntegrationStatus.Success, DateTime.Now); ProjectStatusResponse response = new ProjectStatusResponse(); response.Result = ResponseResult.Success; response.Projects.Add(status); CruiseServerClient client = new CruiseServerClient( new ServerStub("GetProjectStatus", typeof(ServerRequest), response)); client.GetProjectStatus(); }
public void GetArtifactDirectory() { DataResponse response = new DataResponse(); response.Result = ResponseResult.Success; response.Data = "Some data"; CruiseServerClient client = new CruiseServerClient( new ServerStub("GetArtifactDirectory", typeof(ProjectRequest), "Project #1", response)); string result = client.GetArtifactDirectory("Project #1"); Assert.AreEqual(response.Data, result); }
public void GetProjectStatusThrowsExceptionOnFailure() { ProjectStatusResponse response = new ProjectStatusResponse(); IServerConnection connection = mocks.DynamicMock<IServerConnection>(); SetupResult.For(connection.SendMessage("GetProjectStatus", null)) .IgnoreArguments() .Return(response); mocks.ReplayAll(); CruiseServerClient client = new CruiseServerClient(connection); Assert.That(delegate { client.GetProjectStatus(); }, Throws.TypeOf<CommunicationsException>()); }
public void GetProjectStatusReturnsProjects() { ProjectStatus status = new ProjectStatus("Test project", IntegrationStatus.Success, DateTime.Now); ProjectStatusResponse response = new ProjectStatusResponse(); response.Result = ResponseResult.Success; response.Projects.Add(status); IServerConnection connection = mocks.DynamicMock<IServerConnection>(); SetupResult.For(connection.SendMessage("GetProjectStatus", null)) .IgnoreArguments() .Return(response); mocks.ReplayAll(); CruiseServerClient client = new CruiseServerClient(connection); ProjectStatus[] results = client.GetProjectStatus(); Assert.AreEqual(1, results.Length); Assert.AreEqual(status, results[0]); }
public void TakeStatusSnapshot() { var response = new StatusSnapshotResponse(); response.Result = ResponseResult.Success; response.Snapshot = new ProjectStatusSnapshot(); var client = new CruiseServerClient( new ServerStub("TakeStatusSnapshot", typeof(ProjectRequest), "Project #1", response)); var result = client.TakeStatusSnapshot("Project #1"); Assert.AreSame(response.Snapshot, result); }
public void ReadAuditRecordsWithoutFilter() { ReadAuditResponse response = new ReadAuditResponse(); response.Result = ResponseResult.Success; CruiseServerClient client = new CruiseServerClient( new ServerStub("ReadAuditRecords", typeof(ReadAuditRequest), null, response)); client.ReadAuditRecords(0, 10); }
public void ListUsers() { ListUsersResponse response = new ListUsersResponse(); response.Result = ResponseResult.Success; CruiseServerClient client = new CruiseServerClient( new ServerStub("ListUsers", typeof(ServerRequest), null, response)); client.ListUsers(); }
public void RetrieveFileTransfer() { var response = new FileTransferResponse(); response.Result = ResponseResult.Success; response.FileTransfer = this.mocks.StrictMock<IFileTransfer>(); var client = new CruiseServerClient( new ServerStub("RetrieveFileTransfer", typeof(FileTransferRequest), "Project #1", response)); var result = client.RetrieveFileTransfer("Project #1", "Build #1"); Assert.AreSame(response.FileTransfer, result); }
public void AddressReturnsUnderlyingConnectionAddress() { var address = "http://testing"; var connection = mocks.DynamicMock<IServerConnection>(); SetupResult.For(connection.Address).Return(address); mocks.ReplayAll(); CruiseServerClient client = new CruiseServerClient(connection); Assert.AreEqual(address, client.Address); }
public void SessionTokenIsSetCorrectly() { CruiseServerClient client = new CruiseServerClient(null); client.SessionToken = "sessionId"; Assert.AreEqual("sessionId", client.SessionToken); }
public void ChangePasswordSendsRequest() { CruiseServerClient client = new CruiseServerClient(new ServerStub("ChangePassword", typeof(ChangePasswordRequest), "Project #1")); client.ChangePassword("oldPassword", "newPassword"); }
public void GetExternalLinks() { ExternalLinksListResponse response = new ExternalLinksListResponse(); response.Result = ResponseResult.Success; CruiseServerClient client = new CruiseServerClient( new ServerStub("GetExternalLinks", typeof(ProjectRequest), "Project #1", response)); client.GetExternalLinks("Project #1"); }
public void UpdateProjectSendsRequest() { CruiseServerClient client = new CruiseServerClient(new ServerStub("UpdateProject", typeof(ChangeConfigurationRequest), "Project #1")); client.UpdateProject("Project #1", "Data"); }
public void DeleteProjectSendsRequest() { CruiseServerClient client = new CruiseServerClient(new ServerStub("DeleteProject", typeof(ChangeConfigurationRequest), "Project #1")); client.DeleteProject("Project #1", true, true, true); }
public void AddProjectSendsRequest() { CruiseServerClient client = new CruiseServerClient(new ServerStub("AddProject", typeof(ChangeConfigurationRequest))); client.AddProject("Project #1"); }
public void RetrieveFileTransferFailsIfFileNameNotSet() { var client = new CruiseServerClient( new ServerStub("RetrieveFileTransfer", typeof(BuildRequest))); var exception = Assert.Throws<ArgumentNullException>(() => client.RetrieveFileTransfer("Project #1", null)); Assert.AreEqual("fileName", exception.ParamName); }
public void ReadAuditRecordsWithFilter() { ReadAuditResponse response = new ReadAuditResponse(); response.Result = ResponseResult.Success; CruiseServerClient client = new CruiseServerClient( new ServerStub("ReadAuditRecords", typeof(ReadAuditRequest), null, response)); AuditFilterBase filter = AuditFilters.ByProject("Project #1"); client.ReadAuditRecords(0, 10, filter); }
public void GetModificationHistoryDocument() { DataResponse response = new DataResponse(); response.Result = ResponseResult.Success; response.Data = "Some data"; CruiseServerClient client = new CruiseServerClient( new ServerStub("GetModificationHistoryDocument", typeof(ProjectRequest), "Project #1", response)); string result = client.GetModificationHistoryDocument("Project #1"); Assert.AreEqual(response.Data, result); }
public void ListBuildParameters() { BuildParametersResponse response = new BuildParametersResponse(); response.Result = ResponseResult.Success; CruiseServerClient client = new CruiseServerClient( new ServerStub("ListBuildParameters", typeof(ProjectRequest), "Project #1", response)); client.ListBuildParameters("Project #1"); }
public void AbortBuildSendsRequest() { CruiseServerClient client = new CruiseServerClient(new ServerStub("AbortBuild", typeof(ProjectRequest), "Project #1")); client.AbortBuild("Project #1"); }
public void ResetPasswordSendsRequest() { CruiseServerClient client = new CruiseServerClient(new ServerStub("ResetPassword", typeof(ChangePasswordRequest), "Project #1")); client.ResetPassword("userName", "newPassword"); }
public void GetFinalBuildStatusFailsIfBuildNameNotSet() { var client = new CruiseServerClient( new ServerStub("GetFinalBuildStatus", typeof(BuildRequest))); var exception = Assert.Throws<ArgumentNullException>(() => client.GetFinalBuildStatus("Project #1", null)); Assert.AreEqual("buildName", exception.ParamName); }
public void IsBusyReturnsUnderlyingConnectionIsBusy() { IServerConnection connection = mocks.DynamicMock<IServerConnection>(); SetupResult.For(connection.IsBusy).Return(true); mocks.ReplayAll(); CruiseServerClient client = new CruiseServerClient(connection); Assert.IsTrue(client.IsBusy); }
public void GetSecurityConfiguration() { DataResponse response = new DataResponse(); response.Result = ResponseResult.Success; response.Data = "Some data"; CruiseServerClient client = new CruiseServerClient( new ServerStub("GetSecurityConfiguration", typeof(ServerRequest), null, response)); string result = client.GetSecurityConfiguration(); Assert.AreEqual(response.Data, result); }
public void LoginIsFailure() { LoginResponse response = new LoginResponse(); response.Result = ResponseResult.Success; CruiseServerClient client = new CruiseServerClient( new ServerStub("Login", typeof(LoginRequest), null, response)); List<NameValuePair> credentials = new List<NameValuePair>(); bool result = client.Login(credentials); Assert.IsFalse(result); Assert.AreEqual(null, client.SessionToken); }
public void TakeStatusSnapshotFailsIfProjectNameNotSet() { var client = new CruiseServerClient( new ServerStub("TakeStatusSnapshot", typeof(BuildRequest))); var exception = Assert.Throws<ArgumentNullException>(() => client.TakeStatusSnapshot(null)); Assert.AreEqual("projectName", exception.ParamName); }
public void RequestSendsRequest() { CruiseServerClient client = new CruiseServerClient(new ServerStub("ForceBuild", typeof(BuildIntegrationRequest), "Project #1")); client.Request("Project #1", new IntegrationRequest(BuildCondition.ForceBuild, "Me", null)); }
public void Logout() { CruiseServerClient client = new CruiseServerClient( new ServerStub("Logout", typeof(ServerRequest))); client.Logout(); Assert.AreEqual(null, client.SessionToken); }