public string GetOvalResultDocument(string requestId) { using (var session = Repository.GetSession()) { var ovalResults = Repository.GetOvalResults(session, requestId); if (ovalResults == null) { var collectRequest = Repository.GetCollectRequest(session, requestId); if ((collectRequest != null) && (collectRequest.HasResult())) { var collectResult = GetCollectedResultDocument(requestId); if (collectResult != null) { var definitionDocument = this.Repository.GetDefinitionByDocumentId(session, collectRequest.OvalDefinitionsId); if (collectResult.Status == CollectStatus.Error) { throw new Exception(collectResult.ExecutionLogs.FirstOrDefault().Message); } else { var ovalResult = new OvalDefinitionDocumentGenerator().GetDocument(collectRequest, definitionDocument.Text, collectResult); if (ovalResult != null) { string text = ovalResult.GetResultsXML(); Repository.SaveOvalResults(session, requestId, text); return(text); } } } } } else { return(ovalResults.Text); } } return(null); }
public void Should_be_possible_to_get_the_oval_results_document() { //arrange var loadOvalDocument = new OvalDocumentLoader(); var session = GetSession(); var collectRequest = new CollectRequestFactory().CreateCollectRequestCompleteAfterCollect(this.SessionDefault); var newDefinitiondoc = new DefinitionDocument() { OriginalId = "01", Text = loadOvalDocument.GetFakeOvalDefinitions("OvalResultDocumentTest.xml").GetDefinitionsXml()}; session.Store(newDefinitiondoc); collectRequest.OvalDefinitionsId = newDefinitiondoc.Oid; var id = this.SaveCollectRequest(collectRequest, session); var collectResult = new Result(); collectResult.SystemCharacteristics = loadOvalDocument.GetFakeOvalSystemCharacteristics("OvalResultDocumentTest.xml").GetSystemCharacteristicsXML(); var ovalDocumentGenerator = new OvalDefinitionDocumentGenerator(); //act oval_results document = ovalDocumentGenerator.GetDocument(collectRequest, newDefinitiondoc.Text, collectResult); //assert Assert.IsNotNull(document); Assert.AreEqual(ResultEnumeration.@true, document.results[0].definitions[0].result); }
public string GetOvalResultDocument(string requestId) { using (var session = Repository.GetSession()) { var ovalResults = Repository.GetOvalResults(session, requestId); if (ovalResults == null) { var collectRequest = Repository.GetCollectRequest(session, requestId); if ((collectRequest != null) && (collectRequest.HasResult())) { var collectResult = GetCollectedResultDocument(requestId); if (collectResult != null) { var definitionDocument = this.Repository.GetDefinitionByDocumentId(session, collectRequest.OvalDefinitionsId); if (collectResult.Status == CollectStatus.Error) { throw new Exception(collectResult.ExecutionLogs.FirstOrDefault().Message); } else { var ovalResult = new OvalDefinitionDocumentGenerator().GetDocument(collectRequest, definitionDocument.Text, collectResult); if (ovalResult != null) { string text = ovalResult.GetResultsXML(); Repository.SaveOvalResults(session, requestId, text); return text; } } } } } else { return ovalResults.Text; } } return null; }