public void Message_Parse_Success_1() { var error = string.Empty; var test = HL7Helper.AnalyzeResponse(@"PUB|OK|||1| RSP | 1 | TotalPayValue | float | 580.00 | ".Replace("\r\n", "\r"), out error); Assert.Equal(test.Name, ""); }
private void SendRequest(RequestMode query) { string receivedMessage = null; ResultList = null; try { switch (query) { case RequestMode.registry: receivedMessage = HL7Helper.GenerateTeamRegistry(TeamName, RegistryIP, RegistryPort); break; case RequestMode.service: receivedMessage = HL7Helper.GenerateQueryService(TeamName, TeamID, RegistryIP, RegistryPort, ServiceTag); break; case RequestMode.request: receivedMessage = HL7Helper.SendRequest(SelectedService); break; } } catch (Exception e) { Logger.Error("Failed to send HL7 request", e); _dialogService.ShowMessageBox("Failed to send HL7 request."); IsLoading = false; return; } LoadingMessage = "Analyzing"; string error = string.Empty; ResponseHolder serviceResult = null; IWebService queryResult = null; switch (query) { case RequestMode.registry: break; case RequestMode.service: queryResult = HL7Helper.AnalyzeQueryResponse(receivedMessage, out error); break; case RequestMode.request: serviceResult = HL7Helper.AnalyzeResponse(receivedMessage, out error); break; } if (!string.IsNullOrWhiteSpace(error)) { _dialogService.ShowMessageBox(string.Format("Bad response: {0}", error)); Logger.Error(error, new Exception(receivedMessage)); } else { switch (query) { case RequestMode.registry: break; case RequestMode.service: Teams = new List <ITeam>() { new Team(TeamName, new List <IWebService>() { queryResult }) }; break; case RequestMode.request: ResultList = new List <ResponseHolder>() { serviceResult }; break; } } IsLoading = false; return; }