public void TruncateXml_NoChange() { int maximumLength = SampleXml_Large.Length; string result = IcmWorkItemManagment.TruncateXml(SampleXml_Large, maximumLength, -1); Assert.AreEqual(SampleXml_Large, result); }
public void IcmIncidentOverridesValuesTest() { // Tests mix of valid & invalid values and atrributes // Invalid values & fields should be ignored with no side effects, valid fields with valid values should be updated var incident = new Mail2Bug.IcmIncidentsApiODataReference.Incident(); incident.IsNoise = false; Mail2Bug.IcmIncidentsApiODataReference.RootCauseEntity rce = new Mail2Bug.IcmIncidentsApiODataReference.RootCauseEntity(); rce.Title = "Test Root cause"; incident.RootCause = rce; incident.Severity = 4; incident.HitCount = 10; incident.Keywords = "Initial"; incident.OwningTeamId = "Initial"; Dictionary <string, string> values = new Dictionary <string, string>(); values.Add("RootCause", "Error"); values.Add("IsNoise", "Error"); values.Add("HitCount", "Error"); values.Add("DoesntExist", "Error"); values.Add("Keywords", "Changed"); values.Add("OwningTeamId", "Changed"); values.Add("Severity", "3"); IcmWorkItemManagment.ApplyOverrides(ref incident, values); Assert.AreEqual(incident.IsNoise, false); Assert.AreEqual(incident.RootCause, rce); Assert.AreEqual(incident.Keywords, "Changed"); Assert.AreEqual(incident.OwningTeamId, "Changed"); Assert.AreEqual(incident.Severity, 3); Assert.AreEqual(incident.HitCount, 10); }
public void TruncateXml_RemoveHyperlink() { int maximumLength = SampleXml_Large.Length; string result = IcmWorkItemManagment.TruncateXml(SampleXml_Large, maximumLength, 70); // File output for comparison when debugging failure. //WriteStringAsFormattedXml(ExpectedXml_Large01, OutputFileNameA); //WriteStringAsFormattedXml(result, OutputFileNameB); Assert.AreEqual(ExpectedXml_Large01, result); }
public void TruncateXml_LargeInput() { int maximumLength = (int)(SampleXml_Large.Length * 0.75); string result = IcmWorkItemManagment.TruncateXml(SampleXml_Large, maximumLength, -1); // File output for comparison when debugging failure. //WriteStringAsFormattedXml(SampleXml_Large, OutputFileNameA); //WriteStringAsFormattedXml(result, OutputFileNameB); Assert.AreEqual(ExpectedXml_Large00, result); }
public void TruncateXml_DropSiblings() { int maximumLength = SampleXml_Small.Length - 45; string result = IcmWorkItemManagment.TruncateXml(SampleXml_Small, maximumLength, -1); // File output for comparison when debugging failure. //WriteStringAsFormattedXml(SampleXml_Small, OutputFileNameA); //WriteStringAsFormattedXml(result, OutputFileNameB); Assert.AreEqual(ExpectedXml_Small01, result); }
public void GenerateDescriptionEntry() { Dictionary <string, string> values = new Dictionary <string, string> { { FieldNames.Incident.Description, "" }, { FieldNames.Incident.CreatedBy, "" }, { FieldNames.Incident.CreateDate, "" } }; DescriptionEntry result = IcmWorkItemManagment.GenerateDescriptionEntry(values, -1); Assert.Inconclusive(); }
private IMessageProcessingStrategy InitProcessingStrategy() { IWorkItemManager workItemManager = null; if ((_config.IcmClientConfig != null) && (_config.IncidentDefaults != null) && !_config.IcmClientConfig.SimulationMode) { workItemManager = new IcmWorkItemManagment(_config); } if (_config.TfsServerConfig != null && !_config.TfsServerConfig.SimulationMode) { Logger.InfoFormat("Working in standard mode, using TFSWorkItemManager"); workItemManager = new TFSWorkItemManager(_config); } if (_config.TfsServerConfig != null && _config.TfsServerConfig.SimulationMode) { Logger.InfoFormat("Working in simulation mode. Using WorkItemManagerMock"); workItemManager = new WorkItemManagerMock(_config.WorkItemSettings.ConversationIndexFieldName); } Logger.InfoFormat("Initializing MessageProcessingStrategy"); return(new SimpleBugStrategy(_config, workItemManager)); }
public void IcmIncidentOverridesTypeTest() { // Test how overrides handle different types passed as "incident" Dictionary <string, string> values = new Dictionary <string, string>(); values.Add("RootCause", "Error"); values.Add("IsNoise", "Error"); values.Add("Severity", "3"); values.Add("Keywords", "Changed"); // These three should fail without error string testString = ""; IcmWorkItemManagment.ApplyOverrides(ref testString, values); int testInt = 0; IcmWorkItemManagment.ApplyOverrides(ref testInt, values); Mail2Bug.IcmIncidentsApiODataReference.IncidentImpactedComponent testComplexObj = new Mail2Bug.IcmIncidentsApiODataReference.IncidentImpactedComponent(); IcmWorkItemManagment.ApplyOverrides(ref testComplexObj, values); // These two should be handles identically Mail2Bug.IcmIncidentsApiODataReference.Incident testIncident = new Mail2Bug.IcmIncidentsApiODataReference.Incident(); testIncident.Keywords = "Initial"; testIncident.Severity = 4; IcmWorkItemManagment.ApplyOverrides(ref testIncident, values); Assert.AreEqual(testIncident.Severity, 3); Assert.AreEqual(testIncident.Keywords, "Changed"); AlertSourceIncident testAlertSourceIncident = new AlertSourceIncident(); testAlertSourceIncident.Keywords = "Initial"; testAlertSourceIncident.Severity = 4; IcmWorkItemManagment.ApplyOverrides(ref testAlertSourceIncident, values); Assert.AreEqual(testAlertSourceIncident.Severity, 3); Assert.AreEqual(testAlertSourceIncident.Keywords, "Changed"); }
private IMessageProcessingStrategy InitProcessingStrategy() { IWorkItemManager workItemManager = null; if ((_config.IcmClientConfig != null) && (_config.IncidentDefaults != null) && !_config.IcmClientConfig.SimulationMode) { workItemManager = new IcmWorkItemManagment(_config); } if (_config.TfsServerConfig != null && !_config.TfsServerConfig.SimulationMode) { Logger.InfoFormat("Working in standard mode, using TFSWorkItemManager"); workItemManager = new TFSWorkItemManager(_config); } if (_config.TfsServerConfig != null && _config.TfsServerConfig.SimulationMode) { Logger.InfoFormat("Working in simulation mode. Using WorkItemManagerMock"); workItemManager = new WorkItemManagerMock(_config.WorkItemSettings.ConversationIndexFieldName); } Logger.InfoFormat("Initializing MessageProcessingStrategy"); return new SimpleBugStrategy(_config, workItemManager); }
public IcmODataClientTest() { X509Certificate certificate = IcmWorkItemManagment.RetrieveCertificate(CertThumbprint); dataServiceClient = new DataServiceODataClient(new Uri(ServiceUri), null, certificate); }