public void WhenOneCruiseServerSnapshotIsReturnedThisIsContainedInTheReturnedXml()
		{
			CruiseServerSnapshot cruiseServerSnapshot = CreateCruiseServerSnapshot();

			CruiseServerSnapshotOnServer cruiseServerSnapshotOnServer = new CruiseServerSnapshotOnServer(cruiseServerSnapshot, null);
            mockFarmService.ExpectAndReturn("GetCruiseServerSnapshotListAndExceptions",
			                                new CruiseServerSnapshotListAndExceptions(new CruiseServerSnapshotOnServer[] {cruiseServerSnapshotOnServer}, new CruiseServerException[0]),
                                            (string)null);

			XmlFragmentResponse response = (XmlFragmentResponse) reportAction.Execute(null);
			string xml = response.ResponseFragment;

            // cannot just compare the xml string, since we correctly expect the string to vary based on the
			// timezone in which this code is executing
			XmlDocument doc = XPathAssert.LoadAsDocument(xml);
            XPathAssert.Matches(doc, "/CruiseControl/Projects/Project/@name", "HelloWorld");
            XPathAssert.Matches(doc, "/CruiseControl/Projects/Project/@activity", "Sleeping");
            XPathAssert.Matches(doc, "/CruiseControl/Projects/Project/@lastBuildStatus", "Success");
            XPathAssert.Matches(doc, "/CruiseControl/Projects/Project/@lastBuildLabel", "build_7");
            XPathAssert.Matches(doc, "/CruiseControl/Projects/Project/@lastBuildTime", LastBuildTime);
            XPathAssert.Matches(doc, "/CruiseControl/Projects/Project/@nextBuildTime", NextBuildTime);
            XPathAssert.Matches(doc, "/CruiseControl/Projects/Project/@webUrl", "http://blah");
            XPathAssert.Matches(doc, "/CruiseControl/Projects/Project/@category", "category");
            XPathAssert.Matches(doc, "/CruiseControl/Projects/Project/@serverName", Environment.MachineName);

            XPathAssert.Matches(doc, "/CruiseControl/Queues/Queue/@name", "Queue1");
            XPathAssert.Matches(doc, "/CruiseControl/Queues/Queue/Request/@projectName", "HelloWorld");
            XPathAssert.Matches(doc, "/CruiseControl/Queues/Queue/Request/@activity", "CheckingModifications");

			mockFarmService.Verify();
		}
		public void ReturnedXmlValidatesAgainstSchema()
		{
			CruiseServerSnapshot cruiseServerSnapshot = CreateCruiseServerSnapshot();

			CruiseServerSnapshotOnServer cruiseServerSnapshotOnServer = new CruiseServerSnapshotOnServer(cruiseServerSnapshot, null);
            mockFarmService.ExpectAndReturn("GetCruiseServerSnapshotListAndExceptions",
			                                new CruiseServerSnapshotListAndExceptions(new CruiseServerSnapshotOnServer[] {cruiseServerSnapshotOnServer}, new CruiseServerException[0]),
                                            (string)null);

			XmlFragmentResponse response = (XmlFragmentResponse) reportAction.Execute(null);
			string xml = response.ResponseFragment;

            XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
            xmlReaderSettings.Schemas.Add(ReadSchemaFromResources("XmlServerReportActionSchema.xsd"));
            XmlReader rdr = XmlReader.Create(new StringReader(xml), xmlReaderSettings);
			while (rdr.Read())
			{
			}

			mockFarmService.Verify();
		}
 public CruiseServerSnapshotListAndExceptions(CruiseServerSnapshotOnServer[] snapshotAndServerList, CruiseServerException[] exceptions)
 {
     this.snapshotAndServerList = snapshotAndServerList;
     this.exceptions = exceptions;
 }