68 lines
2.4 KiB
C#
Executable File
68 lines
2.4 KiB
C#
Executable File
/* LaurisTimePointTest.cs
|
||
* part of zaaReloaded2
|
||
*
|
||
* Copyright 2015-2017 Daniel Kraus
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using NUnit.Framework;
|
||
using zaaReloaded2.LabModel;
|
||
using zaaReloaded2.Importer.ZaaImporter;
|
||
|
||
namespace Tests.Importer.ZaaImporter
|
||
{
|
||
[TestFixture]
|
||
class LaurisTimePointTest
|
||
{
|
||
[Test]
|
||
public void ParseValidLaurisTimePoint()
|
||
{
|
||
LaurisTimePoint tp = new LaurisTimePoint(
|
||
"(22.10.2013 12:30:00)" + Environment.NewLine +
|
||
"Klinische Chemie: Natrium: 139 [135 - 145] mmol/l; Kalium: 5.2 [3.5 - 5] mmol/l;");
|
||
Assert.IsTrue(tp.IsValidTimePoint);
|
||
}
|
||
|
||
[Test]
|
||
public void ParseInvalidLaurisTimePoints()
|
||
{
|
||
LaurisTimePoint tp = new LaurisTimePoint("Mit freundlichen Grüßen");
|
||
Assert.IsFalse(tp.IsValidTimePoint,
|
||
"Bogus paragraph should be invalid LaurisTimePoint");
|
||
|
||
tp.LaurisText = "(22.10.2013 12:30:00)";
|
||
Assert.IsFalse(tp.IsValidTimePoint,
|
||
"LaurisTimePoint should be invalid if it consists of time stamp only.");
|
||
|
||
}
|
||
|
||
[Test]
|
||
public void ParseLaurisTimePointWithDuplicateItems()
|
||
{
|
||
LaurisTimePoint tp = new LaurisTimePoint(
|
||
"(22.10.2013 12:30:00)" + Environment.NewLine +
|
||
"Klinische Chemie: Natrium: 139 [135 - 145] mmol/l; Kalium: 5.2 [3.5 - 5] mmol/l;" + Environment.NewLine +
|
||
"Klinische Chemie: Natrium: 142 [135 - 145] mmol/l; Kalium: 3.7 [3.5 - 5] mmol/l;"
|
||
);
|
||
Assert.IsTrue(tp.Items.ContainsKey("Kalium"),
|
||
"LaurisTimePoint should contain 'Kalium' item.");
|
||
Assert.AreEqual(3.7, tp.Items["Kalium"].NumericalValue,
|
||
"LaurisTimePoint does not use last occurrence of 'Kalium'.");
|
||
}
|
||
}
|
||
}
|