Fix parsing of drugs with comments.
This commit is contained in:
@ -49,7 +49,7 @@ namespace Tests.Medication
|
||||
public void MultiplePrescriptions()
|
||||
{
|
||||
IEnumerable<Prescription> list = Prescription.ManyFromLine(
|
||||
"Ramipril 5 mg 1-0-0 Prograf 1 mg 1-0-1");
|
||||
"Ramipril 5 mg 1-0-0 \t Prograf 1 mg 1-0-1");
|
||||
Assert.AreEqual(2, list.Count());
|
||||
Assert.AreEqual("Ramipril 5 mg\t1-0-0", list.First().ToString());
|
||||
Assert.AreEqual("Prograf 1 mg\t1-0-1", list.Last().ToString());
|
||||
@ -70,5 +70,36 @@ namespace Tests.Medication
|
||||
Prescription p = new Prescription(drug, morning, noon, evening, night);
|
||||
Assert.AreEqual(formatted, p.ToString());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PrescriptionWithComment()
|
||||
{
|
||||
Prescription p = Prescription.FromLine("Ramipril 5 mg 1-0-2 (gesteigert)");
|
||||
Assert.AreEqual("Ramipril 5 mg", p.Drug);
|
||||
Assert.AreEqual("1", p.Morning);
|
||||
Assert.AreEqual("0", p.Noon);
|
||||
Assert.AreEqual("2", p.Evening);
|
||||
Assert.AreEqual("(gesteigert)", p.Comment);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PrescriptionsLineWithComment()
|
||||
{
|
||||
IList<Prescription> list = Prescription.ManyFromLine(
|
||||
"Ramipril 5 mg 1-0-2 (gesteigert) \t Concor 2,5 mg 3-2-1-0 neu");
|
||||
Assert.AreEqual(2, list.Count);
|
||||
Assert.AreEqual("Ramipril 5 mg", list[0].Drug);
|
||||
Assert.AreEqual("1", list[0].Morning);
|
||||
Assert.AreEqual("0", list[0].Noon);
|
||||
Assert.AreEqual("2", list[0].Evening);
|
||||
Assert.AreEqual("", list[0].Night);
|
||||
Assert.AreEqual("(gesteigert)", list[0].Comment);
|
||||
Assert.AreEqual("Concor 2,5 mg", list[1].Drug);
|
||||
Assert.AreEqual("3", list[1].Morning);
|
||||
Assert.AreEqual("2", list[1].Noon);
|
||||
Assert.AreEqual("1", list[1].Evening);
|
||||
Assert.AreEqual("0", list[1].Night);
|
||||
Assert.AreEqual("neu", list[1].Comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user