zaaReloaded2/Tests/Importer/ZaaImporter/TimePointTest.cs
2015-07-14 15:58:50 +02:00

68 lines
2.5 KiB
C#
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* LaurisTimePointTest.cs
* part of zaaReloaded2
*
* Copyright 2015 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("Aerobe Kultur: Enterokokken ;  Wachstum: 10 ;");
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'.");
}
}
}