zaaReloaded2/Tests/Importer/ClinicImporter/ClinicItemTest.cs

57 lines
2.2 KiB
C#
Raw Normal View History

/* LaurisItemTest.cs
* part of zaaReloaded2
*
* Copyright 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.ClinicImporter
{
/// <summary>
/// The ClinicItemTest really just tests the zaaReloaded2.Importer.ZaaImporter.LaurisItem
/// class with text formatted by the outpatient clinic system to make sure LaurisItem works
/// with clinic-formatted lab data as well.
/// </summary>
[TestFixture]
class ClinicItemTest
{
[Test]
[TestCase(" Natrium: 137 [135 - 145] mmol/l", "Natrium", 137, "mmol/l", 135, 145, true)]
public void ParseClinicWithBothLimits(
string laurisString, string name, double value,
string unit, double lowerLimit, double upperLimit, bool isNormal)
{
LaurisItem i = new LaurisItem(laurisString);
Assert.AreEqual(name, i.Name, "Name");
Assert.AreEqual(unit, i.Unit, "Unit");
Assert.IsFalse(i.IsExtreme, "IsExtreme");
Assert.IsTrue(i.IsNumerical, "IsNumerical");
Assert.AreEqual(value, i.NumericalValue, "NumericalValue");
Assert.AreEqual(lowerLimit, i.LowerLimit, "Lower limit");
Assert.AreEqual(upperLimit, i.UpperLimit, "Upper limit");
Assert.AreEqual(isNormal, i.IsNormal, "IsNormal");
Assert.IsTrue(i.HasLimits, "HasLimits");
Assert.IsTrue(i.HasLowerLimit, "HasLowerLimit");
Assert.IsTrue(i.HasUpperLimit, "HasUpperLimit");
}
}
}