/* TimePointTest.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.ClinicImporter; namespace Tests.Importer.ClinicImporter { [TestFixture] class ClinicTimePointTest { [Test] public void ParseValidClinicTimePoint() { ClinicTimePoint tp = new ClinicTimePoint( "(06.09.2017 09:45:00)" + Environment.NewLine + "\tKalium:\t4.6\t[3.5 - 5]\tmmol/l"); Assert.IsTrue(tp.IsValidTimePoint); } [Test] public void ParseInvalidClinicTimePoints() { ClinicTimePoint tp = new ClinicTimePoint("Mit freundlichen Grüßen"); Assert.IsFalse(tp.IsValidTimePoint, "Bogus paragraph should be invalid LaurisTimePoint"); tp.ClinicText = "(22.10.2013 12:30:00)"; Assert.IsFalse(tp.IsValidTimePoint, "LaurisTimePoint should be invalid if it consists of time stamp only."); } [Test] public void ParseClinicTimePointWithDuplicateItems() { ClinicTimePoint tp = new ClinicTimePoint( "(22.10.2013 12:30:00)" + Environment.NewLine + "\tNatrium:\t137\t[135 - 145]\tmmol/l" + Environment.NewLine + "\tNatrium:\t140\t[135 - 145]\tmmol/l" ); Assert.IsTrue(tp.Items.ContainsKey("Natrium"), "LaurisTimePoint should contain 'Natrium' item."); Assert.AreEqual(140, tp.Items["Natrium"].NumericalValue, "LaurisTimePoint does not use last occurrence of 'Natrium'."); } } }