67 lines
2.3 KiB
C#
Executable File
67 lines
2.3 KiB
C#
Executable File
/* TimePointTest.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.Models;
|
||
|
||
namespace Tests
|
||
{
|
||
[TestFixture]
|
||
class TimePointTest
|
||
{
|
||
[Test]
|
||
public void ParseValidTimePoint()
|
||
{
|
||
TimePoint tp = new TimePoint(
|
||
"[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 ParseInvalidTimePoints()
|
||
{
|
||
TimePoint tp = new TimePoint("Aerobe Kultur: Enterokokken ; Wachstum: 10 ;");
|
||
Assert.IsFalse(tp.IsValidTimePoint,
|
||
"Bogus paragraph should be invalid TimePoint");
|
||
|
||
tp.LaurisText = "[22.10.2013 12:30:00]";
|
||
Assert.IsFalse(tp.IsValidTimePoint,
|
||
"TimePoint should be invalid if it consists of time stamp only.");
|
||
|
||
}
|
||
|
||
[Test]
|
||
public void ParseTimePointWithDuplicateItems()
|
||
{
|
||
TimePoint tp = new TimePoint(
|
||
"[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"),
|
||
"TimePoint should contain 'Kalium' item.");
|
||
Assert.AreEqual(3.7, tp.Items["Kalium"].NumericalValue,
|
||
"TimePoint does not use last occurrence of 'Kalium'.");
|
||
}
|
||
}
|
||
}
|