Make tests pass with refactored ZaaImporter.

This commit is contained in:
Daniel Kraus
2015-08-05 06:15:07 +02:00
parent 285c6a2555
commit 06a74992ef
4 changed files with 48 additions and 6 deletions

View File

@ -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

View File

@ -78,8 +78,18 @@ namespace zaaReloaded2.Importer.ZaaImporter
// create a new time point.
if (LaurisTimePoint.IsTimeStampLine(paragraph))
{
timePoint = new LaurisTimePoint(paragraph);
Laboratory.AddTimePoint(timePoint);
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;
@ -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);