Пример #1
0
        public void NewMessagesAreConcatinated() {
            var sink = new Notifier();
            var filter = new NotifyFilter(sink);
            sink.Error("Boom");

            var executedContext = BuildContext();
            executedContext.Controller.TempData.Add("messages", "dont-destroy");
            filter.OnActionExecuted(executedContext);
            Assert.That(executedContext.Controller.TempData["messages"], Is.StringContaining("dont-destroy"));
            Assert.That(executedContext.Controller.TempData["messages"], Is.StringContaining("dont-destroy"));
        }
Пример #2
0
        public void MessageServiceCanAccumulateWarningsAndErrorsToReturn() {
            INotifier notifier = new Notifier();
            Localizer T = NullLocalizer.Instance;

            notifier.Warning(T("Hello world"));
            notifier.Information(T("More Info"));
            notifier.Error(T("Boom"));

            Assert.That(notifier.List(), Has.Count.EqualTo(3));
            Assert.That(notifier.List(), Has.Some.Property("Message").EqualTo(T("Hello world")));
            Assert.That(notifier.List(), Has.Some.Property("Message").EqualTo(T("More Info")));
            Assert.That(notifier.List(), Has.Some.Property("Message").EqualTo(T("Boom")));
        }