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");
        }
Ejemplo n.º 2
0
        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");
        }