Make tests pass with refactored ZaaImporter.
This commit is contained in:
parent
285c6a2555
commit
06a74992ef
@ -55,6 +55,7 @@ namespace Tests.Formatter
|
||||
{
|
||||
_formatter.Settings.Elements.Add(new Items("Klinische Chemie: Na, K, Cl"));
|
||||
_formatter.Run();
|
||||
Console.WriteLine(_document.Range().Text);
|
||||
Assert.AreEqual(
|
||||
GetResourceText("Tests.Formatter.FormatterTest-all.txt"),
|
||||
_document.Range().Text);
|
||||
|
@ -135,10 +135,8 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
IList<String> paragraphs,
|
||||
Parameters parameterDictionary,
|
||||
Units unitDictionary)
|
||||
: this()
|
||||
: this(parameterDictionary, unitDictionary)
|
||||
{
|
||||
_parameterDictionary = parameterDictionary;
|
||||
_unitDictionary = unitDictionary;
|
||||
Paragraphs = paragraphs;
|
||||
}
|
||||
|
||||
@ -147,6 +145,15 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
{
|
||||
}
|
||||
|
||||
public LaurisTimePoint(
|
||||
Parameters parameterDictionary,
|
||||
Units unitDictionary)
|
||||
: this()
|
||||
{
|
||||
_parameterDictionary = parameterDictionary;
|
||||
_unitDictionary = unitDictionary;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public methods
|
||||
|
@ -78,9 +78,19 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
// create a new time point.
|
||||
if (LaurisTimePoint.IsTimeStampLine(paragraph))
|
||||
{
|
||||
timePoint = new LaurisTimePoint(paragraph);
|
||||
timePoint = new LaurisTimePoint(paragraph, _parameters, _units);
|
||||
// Add the time point to the laboratory only if none
|
||||
// with the same time stamp exists yet.
|
||||
TimePoint existing = null;
|
||||
if (Laboratory.TryGetTimePoint(timePoint.TimeStamp, ref existing))
|
||||
{
|
||||
timePoint = existing as LaurisTimePoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
Laboratory.AddTimePoint(timePoint);
|
||||
}
|
||||
}
|
||||
// If the current paragraph looks like a paragraph with
|
||||
// laboratory items, add it to the current time point;
|
||||
// if no time point exists yet, create one.
|
||||
@ -88,7 +98,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
{
|
||||
if (timePoint == null)
|
||||
{
|
||||
timePoint = new LaurisTimePoint();
|
||||
timePoint = new LaurisTimePoint(_parameters, _units);
|
||||
Laboratory.AddTimePoint(timePoint);
|
||||
}
|
||||
timePoint.AddParagraph(paragraph);
|
||||
|
@ -66,6 +66,30 @@ namespace zaaReloaded2.LabModel
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the Laboratory contains a TimePoint with an identical
|
||||
/// time stamp to the one being queried.
|
||||
/// </summary>
|
||||
/// <param name="timePoint">TimePoint whose time stamp to look for.</param>
|
||||
/// <returns>True if a TimePoint with identical time stamp exists.</returns>
|
||||
public bool HasTimePoint(TimePoint timePoint)
|
||||
{
|
||||
return TimePoints.ContainsKey(timePoint.TimeStamp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks for a TimePoint with a given timeStamp and returns
|
||||
/// it as a reference parameter.
|
||||
/// </summary>
|
||||
/// <param name="timeStamp">Time stamp to look for.</param>
|
||||
/// <param name="timePoint">Resulting TimePoint (if any).</param>
|
||||
/// <returns>True if TimePoints contains a TimePoint with
|
||||
/// the requested timeStamp.</returns>
|
||||
public bool TryGetTimePoint(DateTime timeStamp, ref TimePoint timePoint)
|
||||
{
|
||||
return TimePoints.TryGetValue(timeStamp, out timePoint);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user