/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 51, Configuration.FieldSeparator), Id, SetIdObr.HasValue ? SetIdObr.Value.ToString(culture) : null, PlacerOrderNumber?.ToDelimitedString(), FillerOrderNumber?.ToDelimitedString(), UniversalServiceIdentifier?.ToDelimitedString(), Priority, RequestedDateTime.HasValue ? RequestedDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, ObservationDateTime.HasValue ? ObservationDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, ObservationEndDateTime.HasValue ? ObservationEndDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, CollectionVolume?.ToDelimitedString(), CollectorIdentifier != null ? string.Join(Configuration.FieldRepeatSeparator, CollectorIdentifier.Select(x => x.ToDelimitedString())) : null, SpecimenActionCode, DangerCode?.ToDelimitedString(), RelevantClinicalInformation, SpecimenReceivedDateTime.HasValue ? SpecimenReceivedDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, SpecimenSource?.ToDelimitedString(), OrderingProvider != null ? string.Join(Configuration.FieldRepeatSeparator, OrderingProvider.Select(x => x.ToDelimitedString())) : null, OrderCallbackPhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, OrderCallbackPhoneNumber.Select(x => x.ToDelimitedString())) : null, PlacerField1, PlacerField2, FillerField1, FillerField2, ResultsRptStatusChngDateTime.HasValue ? ResultsRptStatusChngDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, ChargeToPractice?.ToDelimitedString(), DiagnosticServSectId, ResultStatus, ParentResult?.ToDelimitedString(), QuantityTiming != null ? string.Join(Configuration.FieldRepeatSeparator, QuantityTiming.Select(x => x.ToDelimitedString())) : null, ResultCopiesTo != null ? string.Join(Configuration.FieldRepeatSeparator, ResultCopiesTo.Select(x => x.ToDelimitedString())) : null, ParentResultsObservationIdentifier?.ToDelimitedString(), TransportationMode, ReasonForStudy != null ? string.Join(Configuration.FieldRepeatSeparator, ReasonForStudy.Select(x => x.ToDelimitedString())) : null, PrincipalResultInterpreter?.ToDelimitedString(), AssistantResultInterpreter != null ? string.Join(Configuration.FieldRepeatSeparator, AssistantResultInterpreter.Select(x => x.ToDelimitedString())) : null, Technician != null ? string.Join(Configuration.FieldRepeatSeparator, Technician.Select(x => x.ToDelimitedString())) : null, Transcriptionist != null ? string.Join(Configuration.FieldRepeatSeparator, Transcriptionist.Select(x => x.ToDelimitedString())) : null, ScheduledDateTime.HasValue ? ScheduledDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, NumberOfSampleContainers.HasValue ? NumberOfSampleContainers.Value.ToString(Consts.NumericFormat, culture) : null, TransportLogisticsOfCollectedSample != null ? string.Join(Configuration.FieldRepeatSeparator, TransportLogisticsOfCollectedSample.Select(x => x.ToDelimitedString())) : null, CollectorsComment != null ? string.Join(Configuration.FieldRepeatSeparator, CollectorsComment.Select(x => x.ToDelimitedString())) : null, TransportArrangementResponsibility?.ToDelimitedString(), TransportArranged, EscortRequired, PlannedPatientTransportComment != null ? string.Join(Configuration.FieldRepeatSeparator, PlannedPatientTransportComment.Select(x => x.ToDelimitedString())) : null, ProcedureCode?.ToDelimitedString(), ProcedureCodeModifier != null ? string.Join(Configuration.FieldRepeatSeparator, ProcedureCodeModifier.Select(x => x.ToDelimitedString())) : null, PlacerSupplementalServiceInformation != null ? string.Join(Configuration.FieldRepeatSeparator, PlacerSupplementalServiceInformation.Select(x => x.ToDelimitedString())) : null, FillerSupplementalServiceInformation != null ? string.Join(Configuration.FieldRepeatSeparator, FillerSupplementalServiceInformation.Select(x => x.ToDelimitedString())) : null, MedicallyNecessaryDuplicateProcedureReason?.ToDelimitedString(), ResultHandling, ParentUniversalServiceIdentifier?.ToDelimitedString() ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
public void SingleLanguageFileAllOk() { Result languageResult = new Result("languagefile.xml", 10, 5, new Phrase[0], new Phrase[0]); ParentResult result = new ParentResult("masterfile.xml", "pathFilter", 10, 5, new Result[] { languageResult }); var output = this.instance.Generate(result); using (StreamReader reader = new StreamReader(output)) { var report = reader.ReadToEnd(); // Header report.ShouldContain("Master File: masterfile.xml"); report.ShouldContain("Report Generated:"); report.ShouldContain("Total phrases: 10"); report.ShouldContain("Path filter: pathFilter"); report.ShouldContain("1 language files analyzed:"); report.ShouldContain(" languagefile.xml"); // Language 1 results report.ShouldContain("The file name is: languagefile.xml"); report.ShouldContain("Total phrases: 10"); report.ShouldContain("Total filtered phrases: 5"); report.ShouldContain("Untranslated phrases: 0"); report.ShouldContain("Missing phrases: 0"); // TODO: Assert more stuff on report... } }
/// <summary> /// Adds a result to the execution context. /// </summary> /// <param name="result">The result to add</param> public void AddResult(NodeResult result) { if (ParentResult == null) { ParentResult = result; } else if (ParentResult != result) { ParentResult.AddChildResult(result); } }
public void Evaluate(ISearchNode node) { LogFile.Debug("Evaluating node: {0}", node); InnerResult rootResult; var statehash = _game.CalculateHash(); var isNew = _searchResults.CreateOrGetExistingResult( statehash, node.Controller.IsMax, SearchDepth, out rootResult); if (isNew || !ParentResult.HasChildrenWithIndex(ResultIndex)) { ParentResult.AddChild(ResultIndex, rootResult); } if (isNew) { EvaluateBranches(node, rootResult); } else { SubTreesPrunned++; LogFile.Debug("state {0}, prunning node {1}", statehash, node); } // By evaluating each branch we have already traversed the // entire subtree, so we stop the game and yield control to // upper level. _game.Stop(); }
public void SingleLanguageFileMissingAndUntranslatedPhrases() { var untranslatedPhrases = new Phrase[] { new Phrase() { TranslatedValue = "Translated Value 1", Key = "Key1", LineNumber = 1, // etc }, new Phrase() { TranslatedValue = "Translated Value 2", Key = "Key2", LineNumber = 2, } }; var missingPhrases = new Phrase[] { new Phrase() { TranslatedValue = "Missing Value 1", Key = "Key3", LineNumber = 3, // etc }, new Phrase() { TranslatedValue = "Missing Value 2", Key = "Key4", LineNumber = 4, } }; Result languageResult = new Result("languagefile.xml", 10, 5, untranslatedPhrases, missingPhrases); ParentResult result = new ParentResult("masterfile.xml", "pathFilter", 10, 5, new Result[] { languageResult }); var output = this.instance.Generate(result); using (StreamReader reader = new StreamReader(output)) { var report = reader.ReadToEnd(); // Header report.ShouldContain("Master File: masterfile.xml"); report.ShouldContain("Report Generated:"); report.ShouldContain("Total phrases: 10"); report.ShouldContain("Path filter: pathFilter"); report.ShouldContain("1 language files analyzed:"); report.ShouldContain(" languagefile.xml"); // Language 1 results report.ShouldContain("The file name is: languagefile.xml"); report.ShouldContain("Total phrases: 10"); report.ShouldContain("Total filtered phrases: 5"); report.ShouldContain("Untranslated phrases: 2"); foreach (var untranslatedPhrase in untranslatedPhrases) { report.ShouldContain($" Line={untranslatedPhrase.LineNumber}"); report.ShouldContain($" Value={untranslatedPhrase.TranslatedValue}"); report.ShouldContain($" Key={untranslatedPhrase.Key}"); } report.ShouldContain("Missing phrases: 2"); foreach (var missingPhrase in missingPhrases) { report.ShouldContain($" Line={missingPhrase.LineNumber}"); report.ShouldContain($" Value={missingPhrase.TranslatedValue}"); report.ShouldContain($" Key={missingPhrase.Key}"); } // TODO: Assert more stuff on report... } }