zaaReloaded2/Tests/Importer/ZaaImporter/TimePointTest.cs

68 lines
2.4 KiB
C#
Raw Permalink Normal View History

2015-07-06 13:48:43 +00:00
/* LaurisTimePointTest.cs
2015-07-04 10:09:39 +00:00
* part of zaaReloaded2
*
2017-02-23 15:44:07 +00:00
* Copyright 2015-2017 Daniel Kraus
2015-07-04 10:09:39 +00:00
*
* 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;
2015-07-06 13:48:43 +00:00
using zaaReloaded2.LabModel;
using zaaReloaded2.Importer.ZaaImporter;
2015-07-04 10:09:39 +00:00
2015-07-06 13:48:43 +00:00
namespace Tests.Importer.ZaaImporter
2015-07-04 10:09:39 +00:00
{
[TestFixture]
2015-07-06 13:48:43 +00:00
class LaurisTimePointTest
2015-07-04 10:09:39 +00:00
{
[Test]
2015-07-06 13:48:43 +00:00
public void ParseValidLaurisTimePoint()
2015-07-04 10:09:39 +00:00
{
2015-07-06 13:48:43 +00:00
LaurisTimePoint tp = new LaurisTimePoint(
2015-07-14 13:58:18 +00:00
"(22.10.2013 12:30:00)" + Environment.NewLine +
2015-07-04 10:09:39 +00:00
"Klinische Chemie: Natrium: 139 [135 - 145] mmol/l;  Kalium: 5.2 [3.5 - 5] mmol/l;");
Assert.IsTrue(tp.IsValidTimePoint);
}
[Test]
2015-07-06 13:48:43 +00:00
public void ParseInvalidLaurisTimePoints()
2015-07-04 10:09:39 +00:00
{
2015-08-09 17:54:48 +00:00
LaurisTimePoint tp = new LaurisTimePoint("Mit freundlichen Grüßen");
2015-07-04 10:09:39 +00:00
Assert.IsFalse(tp.IsValidTimePoint,
2015-07-06 13:48:43 +00:00
"Bogus paragraph should be invalid LaurisTimePoint");
2015-07-04 10:09:39 +00:00
2015-07-14 13:58:18 +00:00
tp.LaurisText = "(22.10.2013 12:30:00)";
2015-07-04 10:09:39 +00:00
Assert.IsFalse(tp.IsValidTimePoint,
2015-07-06 13:48:43 +00:00
"LaurisTimePoint should be invalid if it consists of time stamp only.");
2015-07-04 10:09:39 +00:00
}
[Test]
2015-07-06 13:48:43 +00:00
public void ParseLaurisTimePointWithDuplicateItems()
2015-07-04 10:09:39 +00:00
{
2015-07-06 13:48:43 +00:00
LaurisTimePoint tp = new LaurisTimePoint(
2015-07-14 13:58:18 +00:00
"(22.10.2013 12:30:00)" + Environment.NewLine +
2015-07-04 10:09:39 +00:00
"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"),
2015-07-06 13:48:43 +00:00
"LaurisTimePoint should contain 'Kalium' item.");
2015-07-04 10:09:39 +00:00
Assert.AreEqual(3.7, tp.Items["Kalium"].NumericalValue,
2015-07-06 13:48:43 +00:00
"LaurisTimePoint does not use last occurrence of 'Kalium'.");
2015-07-04 10:09:39 +00:00
}
}
}