本文整理汇总了C#中ThoughtWorks.CruiseControl.Remote.ProjectStatus类的典型用法代码示例。如果您正苦于以下问题:C# ProjectStatus类的具体用法?C# ProjectStatus怎么用?C# ProjectStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectStatus类属于ThoughtWorks.CruiseControl.Remote命名空间,在下文中一共展示了ProjectStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteProjectStatus
private static void WriteProjectStatus(XmlWriter xmlWriter, ProjectStatus status, IServerSpecifier serverSpecifier)
{
xmlWriter.WriteStartElement("Project");
xmlWriter.WriteAttributeString("name", status.Name);
xmlWriter.WriteAttributeString("category", status.Category);
xmlWriter.WriteAttributeString("activity", status.Activity.ToString());
xmlWriter.WriteAttributeString("lastBuildStatus", status.BuildStatus.ToString());
xmlWriter.WriteAttributeString("lastBuildLabel", status.LastSuccessfulBuildLabel);
xmlWriter.WriteAttributeString("lastBuildTime", XmlConvert.ToString(status.LastBuildDate, XmlDateTimeSerializationMode.Local));
xmlWriter.WriteAttributeString("nextBuildTime", XmlConvert.ToString(status.NextBuildTime, XmlDateTimeSerializationMode.Local));
xmlWriter.WriteAttributeString("webUrl", status.WebURL);
xmlWriter.WriteAttributeString("CurrentMessage", status.CurrentMessage);
xmlWriter.WriteAttributeString("BuildStage", status.BuildStage);
xmlWriter.WriteAttributeString("serverName", serverSpecifier.ServerName);
xmlWriter.WriteAttributeString("description", status.Description);
xmlWriter.WriteStartElement("messages");
foreach (Message m in status.Messages)
{
xmlWriter.WriteStartElement("message");
xmlWriter.WriteAttributeString("text", m.Text);
xmlWriter.WriteAttributeString("kind", m.Kind.ToString());
xmlWriter.WriteEndElement();
}
xmlWriter.WriteEndElement();
xmlWriter.WriteEndElement();
}
示例2: ToStringSerialisesAllValues
public void ToStringSerialisesAllValues()
{
ProjectStatus projectStatus = new ProjectStatus("test project", IntegrationStatus.Success, DateTime.Now);
ProjectStatusResponse response = new ProjectStatusResponse();
response.ErrorMessages.Add(new ErrorMessage("Error 1"));
response.ErrorMessages.Add(new ErrorMessage("Error 2"));
response.RequestIdentifier = "request";
response.Result = ResponseResult.Success;
response.Timestamp = DateTime.Now;
response.Projects.Add(projectStatus);
string actual = response.ToString();
string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture,"<projectStatusResponse xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
"timestamp=\"{2:yyyy-MM-ddTHH:mm:ss.FFFFFFFzzz}\" identifier=\"{0}\" result=\"{1}\">" +
"<error>Error 1</error>" +
"<error>Error 2</error>" +
"<project showForceBuildButton=\"true\" showStartStopButton=\"true\" serverName=\"{5}\" status=\"Running\" buildStatus=\"Success\" name=\"test project\" " +
"queuePriority=\"0\" lastBuildDate=\"{3:yyyy-MM-ddTHH:mm:ss.FFFFFFF}\" nextBuildTime=\"{4:yyyy-MM-ddTHH:mm:ss.FFFFFFF}\">" +
"<activity type=\"Sleeping\" />" +
"</project>" +
"</projectStatusResponse>",
response.RequestIdentifier,
response.Result,
response.Timestamp,
projectStatus.LastBuildDate,
projectStatus.NextBuildTime,
Environment.MachineName);
Assert.AreEqual(expected, actual);
}
示例3: DisplayProject
private static void DisplayProject(ProjectStatus project)
{
WriteLine(string.Format("{0}: {1}", project.Name, project.Status), ConsoleColor.White);
WriteLine(string.Format("\tActivity: {0}", project.Activity), ConsoleColor.White);
WriteLine(string.Format("\tBuild Status: {0}", project.BuildStatus), ConsoleColor.White);
if (!string.IsNullOrEmpty(project.BuildStage))
{
XmlDocument stageXml = new XmlDocument();
try
{
stageXml.LoadXml(project.BuildStage);
foreach (XmlElement stageItem in stageXml.SelectNodes("/data/Item"))
{
string stageTime = stageItem.GetAttribute("Time");
string stageData = stageItem.GetAttribute("Data");
WriteLine(string.Format("\tBuild Stage: {0} ({1})", stageData, stageTime), ConsoleColor.White);
}
}
catch
{
WriteLine(string.Format("\tBuild Stage: {0}", project.BuildStage), ConsoleColor.White);
}
}
WriteLine(string.Format("\tLast Build: {0:G}", project.LastBuildDate), ConsoleColor.White);
WriteLine(string.Format("\tNext Build: {0:G}", project.NextBuildTime), ConsoleColor.White);
}
示例4: ProjectGridRow
public ProjectGridRow(ProjectStatus status, IServerSpecifier serverSpecifier,
string url, string parametersUrl, Translations translations)
{
this.status = status;
this.serverSpecifier = serverSpecifier;
this.url = url;
this.parametersUrl = parametersUrl;
}
示例5: CompareProjectStatusByQueueAndQueuePriority
private int CompareProjectStatusByQueueAndQueuePriority(ProjectStatus x, ProjectStatus y)
{
if (x.Queue == y.Queue)
{
return x.QueuePriority.CompareTo(y.QueuePriority);
}
return x.Queue.CompareTo(y.Queue);
}
示例6: NameReturnsNameFromStatus
public void NameReturnsNameFromStatus()
{
var client = mocks.DynamicMock<CruiseServerClientBase>();
var server = InitialiseServer();
var status = new ProjectStatus { Name = "Test Project" };
var project = new Project(client, server, status);
mocks.ReplayAll();
Assert.AreEqual(status.Name, project.Name);
}
示例7: ServerReturnsUnderlyingServer
public void ServerReturnsUnderlyingServer()
{
var client = mocks.DynamicMock<CruiseServerClientBase>();
var server = InitialiseServer();
var status = new ProjectStatus();
var project = new Project(client, server, status);
mocks.ReplayAll();
Assert.AreSame(server, project.Server);
}
示例8: ShouldReturnNullIfNamedProjectNotFound
public void ShouldReturnNullIfNamedProjectNotFound()
{
ProjectStatus[] projectStatuses = new ProjectStatus[1];
projectStatuses[0] = new ProjectStatus("no names", IntegrationStatus.Failure, DateTime.Now);
CruiseServerSnapshot cruiseServerSnapshot = new CruiseServerSnapshot(projectStatuses, null);
Assert.IsNull(cruiseServerSnapshot.GetProjectStatus("this doesn't match"));
}
示例9: GetProjectStatusSendsRequest
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();
}
示例10: CorrectAssignmentOfConstructorArguments
public void CorrectAssignmentOfConstructorArguments()
{
ProjectStatus[] projectStatuses = new ProjectStatus[0];
QueueSetSnapshot queueSetSnapshot = new QueueSetSnapshot();
CruiseServerSnapshot cruiseServerSnapshot = new CruiseServerSnapshot(projectStatuses, queueSetSnapshot);
Assert.AreSame(projectStatuses, cruiseServerSnapshot.ProjectStatuses);
Assert.AreSame(queueSetSnapshot, cruiseServerSnapshot.QueueSetSnapshot);
}
示例11: ShouldFindProjectStatusBasedOnProjectName
public void ShouldFindProjectStatusBasedOnProjectName()
{
ProjectStatus[] projectStatuses = new ProjectStatus[2];
projectStatuses[0] = new ProjectStatus("test1", IntegrationStatus.Failure, DateTime.Now);
projectStatuses[1] = new ProjectStatus("test2", IntegrationStatus.Success, DateTime.Now);
CruiseServerSnapshot cruiseServerSnapshot = new CruiseServerSnapshot(projectStatuses, null);
Assert.AreSame(projectStatuses[0], cruiseServerSnapshot.GetProjectStatus("test1"));
Assert.AreSame(projectStatuses[1], cruiseServerSnapshot.GetProjectStatus("test2"));
}
示例12: WhenPollIsCalledRetrievesANewCopyOfTheProjectStatus
public void WhenPollIsCalledRetrievesANewCopyOfTheProjectStatus()
{
ProjectStatus status = new ProjectStatus();
mockProjectManager.ExpectAndReturn("ProjectName", PROJECT_NAME);
mockServerMonitor.ExpectAndReturn("GetProjectStatus", status, PROJECT_NAME);
monitor.Poll();
// deliberately called twice: should not go back to server on 2nd
// call
Assert.AreSame(status, monitor.ProjectStatus);
Assert.AreSame(status, monitor.ProjectStatus);
}
示例13: SaveAndLoadProjectStatus
public void SaveAndLoadProjectStatus()
{
ProjectStatus projectStatus = new ProjectStatus("project", "category", ProjectActivity.Building, IntegrationStatus.Failure,
ProjectIntegratorState.Running, "http://localhost/ccnet", DateTime.Now, "1.0", "1.0", DateTime.Now, "building", "", 0);
BinaryFormatter binaryFormatter = new BinaryFormatter();
using (MemoryStream stream = new MemoryStream())
{
binaryFormatter.Serialize(stream, projectStatus);
stream.Seek(0, SeekOrigin.Begin);
binaryFormatter.Deserialize(stream);
}
}
示例14: ThePollEventIsFiredWhenPollIsInvoked
public void ThePollEventIsFiredWhenPollIsInvoked()
{
Assert.AreEqual(0, pollCount);
ProjectStatus status = new ProjectStatus();
mockProjectManager.ExpectAndReturn("ProjectName", PROJECT_NAME);
mockServerMonitor.ExpectAndReturn("GetProjectStatus", status, PROJECT_NAME);
monitor.Poll();
Assert.AreEqual(1, pollCount);
mockProjectManager.ExpectAndReturn("ProjectName", PROJECT_NAME);
mockServerMonitor.ExpectAndReturn("GetProjectStatus", status, PROJECT_NAME);
monitor.Poll();
Assert.AreEqual(2, pollCount);
}
示例15: ToStringSerialisesAllValues
public void ToStringSerialisesAllValues()
{
QueueSnapshot queueSnapshot = new QueueSnapshot("queue1");
queueSnapshot.Requests.Add(new QueuedRequestSnapshot("test project", ProjectActivity.Pending));
QueueSetSnapshot queueSetSnapshot = new QueueSetSnapshot();
queueSetSnapshot.Queues.Add(queueSnapshot);
ProjectStatus projectStatus = new ProjectStatus("test project", IntegrationStatus.Success, DateTime.Now);
CruiseServerSnapshot snapshot = new CruiseServerSnapshot(
new ProjectStatus[] { projectStatus },
queueSetSnapshot);
SnapshotResponse response = new SnapshotResponse();
response.ErrorMessages.Add(new ErrorMessage("Error 1"));
response.ErrorMessages.Add(new ErrorMessage("Error 2"));
response.RequestIdentifier = "request";
response.Result = ResponseResult.Success;
response.Timestamp = DateTime.Now;
response.Snapshot = snapshot;
string actual = response.ToString();
string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture,"<snapshotResponse xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
"timestamp=\"{2:yyyy-MM-ddTHH:mm:ss.FFFFFFFzzz}\" identifier=\"{0}\" result=\"{1}\">" +
"<error>Error 1</error>" +
"<error>Error 2</error>" +
"<snapshot>" +
"<projects>" +
"<projectStatus showForceBuildButton=\"true\" showStartStopButton=\"true\" serverName=\"{6}\" status=\"Running\" buildStatus=\"Success\" name=\"test project\" " +
"queuePriority=\"0\" lastBuildDate=\"{3:yyyy-MM-ddTHH:mm:ss.FFFFFFF}\" nextBuildTime=\"{4:yyyy-MM-ddTHH:mm:ss.FFFFFFF}\">" +
"<activity type=\"Sleeping\" />" +
"<parameters />" +
"</projectStatus>" +
"</projects>" +
"<queueSet>" +
"<queue name=\"queue1\">" +
"<queueRequest projectName=\"test project\" time=\"{5:yyyy-MM-ddTHH:mm:ss.FFFFFFF}\">" +
"<activity type=\"Pending\" />" +
"</queueRequest>" +
"</queue>" +
"</queueSet>" +
"</snapshot>" +
"</snapshotResponse>",
response.RequestIdentifier,
response.Result,
response.Timestamp,
projectStatus.LastBuildDate,
projectStatus.NextBuildTime,
DateTime.MinValue,
Environment.MachineName);
Assert.AreEqual(expected, actual);
}