/// <summary> /// Populates the template based on the provided data. /// Writes the entry to the log. /// </summary> /// <param name="errorMessage">Description of the failure.</param> /// <param name="userId">User Unique Identifier in the new service.</param> /// <param name="OldId">User Unique Identifier in the old service.</param> /// <param name="severity">Type of failure.</param> /// <param name="newServiceUrl">URL of the new service being called (for the specific User Identifier).</param> /// <param name="memberName">Test method generated name.</param> /// <param name="taskDescription">Human-readable description of the test.</param> /// <param name="optionalExplanation">Hint on what caused the issue.</param> /// <remarks>If the test result is SUCCESS, the entry is logged only if DEBUG mode specified.</remarks> public void LogTestResult(string oldUrl, string newServiceUrl, ResultReport resultReport) { UpdateStatistics(resultReport); if (TestSuiteUser.IsDebugMode || (resultReport.Severity != EnumResultSeverityType.SUCCESS && resultReport.Severity != EnumResultSeverityType.WARNING_NO_DATA)) { var detailedReportData = new DetailedReportSharedData(resultReport) { OldUrl = oldUrl, NewUrl = newServiceUrl }; WriteDetailedEntry(detailedReportData, resultReport.DisplayFormat); } }
/// <summary> /// Populates the appropriate template based on the display format needed (Un)Structured Lists/Tree of Organizations. /// </summary> /// <param name="templateData"></param> /// <param name="displayFormat"></param> private static void WriteDetailedEntry(DetailedReportSharedData templateData, EnumResultDisplayFormat displayFormat) { lock (lockLogResult) { switch (displayFormat) { case EnumResultDisplayFormat.ListOfValues: var templateListValues = new DetailedReportUnstructuredLists(); templateListValues.Session = new Dictionary <string, object>() { { "SharedDataObject", templateData } }; templateListValues.Initialize(); if (detailedReportsWriters.ContainsKey(templateData.TestName)) { detailedReportsWriters[templateData.TestName].WriteLine(templateListValues.TransformText()); } else { System.Diagnostics.Debug.WriteLine("no writer for " + templateData.TestName); } break; case EnumResultDisplayFormat.OrganizationTree: var templateOrgTree = new DetailedReportOrganizationTree(); templateOrgTree.Session = new Dictionary <string, object>() { { "SharedDataObject", templateData } }; templateOrgTree.Initialize(); if (detailedReportsWriters.ContainsKey(templateData.TestName)) { detailedReportsWriters[templateData.TestName].WriteLine(templateOrgTree.TransformText()); } else { System.Diagnostics.Debug.WriteLine("no writer for " + templateData.TestName); } break; case EnumResultDisplayFormat.StructureOfValues: var templateListStructures = new DetailedReportStructuredLists(); templateListStructures.Session = new Dictionary <string, object>() { { "SharedDataObject", templateData } }; templateListStructures.Initialize(); if (detailedReportsWriters.ContainsKey(templateData.TestName)) { detailedReportsWriters[templateData.TestName].WriteLine(templateListStructures.TransformText()); } else { System.Diagnostics.Debug.WriteLine("no writer for " + templateData.TestName); } break; } } }