Improve date and time header (some tests failing now).
- NEU: Datumsangaben werden in eine Zeile "Laborwerte vom ..." eingebettet.
This commit is contained in:
parent
2cefede3c0
commit
476f2d69be
@ -61,7 +61,9 @@ namespace Tests.Controller.Elements
|
||||
_formatter.Laboratory = lab;
|
||||
_formatter.Settings.Elements.Add(new zaa.Items("Na, K, Cl"));
|
||||
_formatter.Run();
|
||||
Assert.AreEqual("\r13.07.2015 13:31:00:\rNa 133, K 6 (5)\r\r", _document.Range().Text);
|
||||
Assert.AreEqual("\r" +
|
||||
TimePointFormatter.DateAndTimeHeader(new DateTime(2015, 07, 13, 13, 31, 00)) +
|
||||
"\rNa 133, K 6 (5)\r\r", _document.Range().Text);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -78,7 +80,9 @@ namespace Tests.Controller.Elements
|
||||
_formatter.Laboratory = lab;
|
||||
_formatter.Settings.Elements.Add(new zaa.Items("Klinische Chemie: Na, K, Cl"));
|
||||
_formatter.Run();
|
||||
Assert.AreEqual("\r13.07.2015 13:31:00:\rKlinische Chemie: Na 133, K 6 (5)\r\r", _document.Range().Text);
|
||||
Assert.AreEqual("\r" +
|
||||
TimePointFormatter.DateAndTimeHeader(new DateTime(2015, 07, 13, 13, 31, 00)) +
|
||||
"\rKlinische Chemie: Na 133, K 6 (5)\r\r", _document.Range().Text);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -113,7 +117,9 @@ namespace Tests.Controller.Elements
|
||||
_formatter.Laboratory = lab;
|
||||
_formatter.Settings.Elements.Add(new zaa.Items("Klinische Chemie: Na, *"));
|
||||
_formatter.Run();
|
||||
Assert.AreEqual("\r13.07.2015 13:31:00:\rKlinische Chemie: Na 133, Cl 110, K 6\r\r",
|
||||
Assert.AreEqual("\r" +
|
||||
TimePointFormatter.DateAndTimeHeader(new DateTime(2015, 07, 13, 13, 31, 00)) +
|
||||
"\rKlinische Chemie: Na 133, Cl 110, K 6\r\r",
|
||||
_document.Range().Text);
|
||||
}
|
||||
|
||||
@ -133,7 +139,9 @@ namespace Tests.Controller.Elements
|
||||
_formatter.Laboratory = lab;
|
||||
_formatter.Settings.Elements.Add(new zaa.Items("Klinische Chemie: Na, SU-*"));
|
||||
_formatter.Run();
|
||||
Assert.AreEqual("\r13.07.2015 13:31:00:\rKlinische Chemie: Na 133, SU-Protein 2,8\r\r",
|
||||
Assert.AreEqual("\r" +
|
||||
TimePointFormatter.DateAndTimeHeader(new DateTime(2015, 07, 13, 13, 31, 00)) +
|
||||
"\rKlinische Chemie: Na 133, SU-Protein 2,8\r\r",
|
||||
_document.Range().Text);
|
||||
}
|
||||
|
||||
@ -153,7 +161,9 @@ namespace Tests.Controller.Elements
|
||||
_formatter.Laboratory = lab;
|
||||
_formatter.Settings.Elements.Add(new zaa.Items("Klinische Chemie: Na, SU-*, *"));
|
||||
_formatter.Run();
|
||||
Assert.AreEqual("\r13.07.2015 13:31:00:\rKlinische Chemie: Na 133, SU-Protein 2,8, Cl 110, U-Na 99\r\r",
|
||||
Assert.AreEqual("\r" +
|
||||
TimePointFormatter.DateAndTimeHeader(new DateTime(2015, 07, 13, 13, 31, 00)) +
|
||||
"\rKlinische Chemie: Na 133, SU-Protein 2,8, Cl 110, U-Na 99\r\r",
|
||||
_document.Range().Text);
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,33 @@ namespace zaaReloaded2.Formatter
|
||||
/// </summary>
|
||||
public class TimePointFormatter
|
||||
{
|
||||
#region Static methods
|
||||
|
||||
public static string DateHeader(DateTime date)
|
||||
{
|
||||
return FormatHeader(date.ToShortDateString());
|
||||
}
|
||||
|
||||
public static string DateAndTimeHeader(DateTime dateTime)
|
||||
{
|
||||
return FormatHeader(dateTime.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private static methods
|
||||
|
||||
static string FormatHeader(string text)
|
||||
{
|
||||
return String.Format("{0}Laborwerte vom {1}:{2}",
|
||||
Environment.NewLine,
|
||||
text,
|
||||
Environment.NewLine
|
||||
);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
@ -77,7 +104,7 @@ namespace zaaReloaded2.Formatter
|
||||
/// <returns></returns>
|
||||
public string GetDateHeader()
|
||||
{
|
||||
return FormatHeader(TimeStamp.ToShortDateString());
|
||||
return DateHeader(TimeStamp);
|
||||
}
|
||||
|
||||
|
||||
@ -88,20 +115,7 @@ namespace zaaReloaded2.Formatter
|
||||
/// <returns></returns>
|
||||
public string GetDateAndTimeHeader()
|
||||
{
|
||||
return FormatHeader(TimeStamp.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private methods
|
||||
|
||||
string FormatHeader(string text)
|
||||
{
|
||||
return String.Format("{0}{1}:{2}",
|
||||
Environment.NewLine,
|
||||
text,
|
||||
Environment.NewLine
|
||||
);
|
||||
return DateAndTimeHeader(TimeStamp);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
Loading…
Reference in New Issue
Block a user