Working comments with CommentPool.
This commit is contained in:
@ -24,7 +24,9 @@ using Microsoft.Office.Interop.Word;
|
||||
using zaaReloaded2.LabModel;
|
||||
using zaaReloaded2.Formatter;
|
||||
using zaa = zaaReloaded2.Controller.Elements;
|
||||
using zaaReloaded2.Controller.Comments;
|
||||
using System.Text.RegularExpressions;
|
||||
using zaaReloaded2.Controller.Comments;
|
||||
|
||||
namespace Tests.Controller.Elements
|
||||
{
|
||||
@ -203,6 +205,35 @@ namespace Tests.Controller.Elements
|
||||
Assert.AreEqual(expected, _document.Range().Text);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ItemCommentWithHandler()
|
||||
{
|
||||
Laboratory lab = new Laboratory();
|
||||
TimePoint tp = new TimePoint();
|
||||
tp.TimeStamp = new DateTime(2015, 7, 13, 13, 31, 00);
|
||||
tp.AddItem(new LabItem("Na", "133", "133"));
|
||||
tp.AddItem(new LabItem("K", "6", "5"));
|
||||
lab.AddTimePoint(tp);
|
||||
|
||||
_formatter.Laboratory = lab;
|
||||
_formatter.Settings.Elements.Add(
|
||||
new zaa.Items("Na \"(Zielbereich: <default> µg/l)\""));
|
||||
bool messageSent = false;
|
||||
CommentPool.Default.FillInComment += (sender, args) =>
|
||||
{
|
||||
messageSent = true;
|
||||
args.Comment.Value = "4-7";
|
||||
};
|
||||
_formatter.Run();
|
||||
Assert.IsTrue(messageSent, "FillInComment message was not sent");
|
||||
string expected = (
|
||||
StripMarkup(
|
||||
TimePointFormatter.DateAndTimeHeader(new DateTime(2015, 07, 13, 13, 31, 00)) +
|
||||
"Na 133 (Zielbereich: 4-7 µg/l)\r\r").Replace(Environment.NewLine, "\r")
|
||||
);
|
||||
Assert.AreEqual(expected, _document.Range().Text);
|
||||
}
|
||||
|
||||
static string StripMarkup(string s)
|
||||
{
|
||||
return _markupStripper.Replace(s, string.Empty);
|
||||
|
Reference in New Issue
Block a user