internal static List <string> ValidateSpecificationTestInstance(string vendorCode, string applicationName, string applicationVersion, string specification, string testData) { List <string> validationResults = new List <string>(); try { StringBuilder reportTransport = new StringBuilder(); StringBuilder reportFormat = new StringBuilder(); StringBuilder reportData = new StringBuilder(); bool passedTransport = false; bool passedFormat = false; bool passedData = false; // check vendor remaining parameters if (string.IsNullOrEmpty(vendorCode) || string.IsNullOrEmpty(applicationName) || string.IsNullOrEmpty(applicationVersion)) { throw new Exception("Incomplete vendor and/or application details supplied"); } // check that test instance supplied if (string.IsNullOrEmpty(testData)) { throw new Exception("No Test Data supplied"); } // determine which specification type has been requested SpecificationType specType = Specification.GetSpecificationType(specification); if (specType == SpecificationType.Unknown) { throw new Exception("Unrecognised Specification Type: " + specification); } // validate the passed Test Data validationResults.AddRange(Specification.Validate(specType, testData)); // iterate through Validation Report List and populate Report Type properties string reportLineType = "T"; foreach (string reportLine in validationResults) { if (reportLine.StartsWith("TRANSPORT :")) { reportLineType = "T"; passedTransport = reportLine.StartsWith("TRANSPORT : Pass"); } else if (reportLine.StartsWith("FORMAT :")) { reportLineType = "F"; passedFormat = reportLine.StartsWith("FORMAT : Pass"); } else if (reportLine.StartsWith("DATA :")) { reportLineType = "D"; passedData = reportLine.StartsWith("DATA : Pass"); } if (reportLineType == "T") { reportTransport.AppendLine(reportLine); } else if (reportLineType == "F") { reportFormat.AppendLine(reportLine); } else if (reportLineType == "D") { reportData.AppendLine(reportLine); } } // Store Validation Result in Patients First DB ValidationResult.AddValidationResult( applicationName, applicationVersion, specification, passedTransport, passedFormat, passedData, reportTransport.ToString(), reportFormat.ToString(), reportData.ToString(), vendorCode ); } catch (Exception ex) { Log.Write("ERROR: " + ex.ToString(), LogLevel.ExceptionOnly); throw; } return(validationResults); }