public void TestAddMessages()
        {
            InitializeHttpContext();

            var store = new FeedbackMessageStore();

            List <FeedbackMessage> messages = new List <FeedbackMessage>();

            var info = FeedbackMessage.Info("Test info message.");
            var warn = FeedbackMessage.Warn("Test warn message.");

            messages.Add(info);
            messages.Add(warn);

            store.AddMessages(messages);

            IList <FeedbackMessage> infoMessages = store.GetFeedbackMessages(FeedbackMessageLevel.INFO);

            Assert.AreEqual(1, infoMessages.Count);
            Assert.IsTrue(infoMessages.Contains(info));

            IList <FeedbackMessage> successMessages = store.GetFeedbackMessages(FeedbackMessageLevel.SUCCESS);

            Assert.AreEqual(0, successMessages.Count);

            IList <FeedbackMessage> warnMessages = store.GetFeedbackMessages(FeedbackMessageLevel.WARN);

            Assert.AreEqual(1, warnMessages.Count);
            Assert.IsTrue(warnMessages.Contains(warn));

            IList <FeedbackMessage> errorMessages = store.GetFeedbackMessages(FeedbackMessageLevel.ERROR);

            Assert.AreEqual(0, errorMessages.Count);
        }
        public void TestAddMessage()
        {
            InitializeHttpContext();

            var store = new FeedbackMessageStore();

            var feedbackMessage = FeedbackMessage.Info("Test info message.");

            store.AddMessage(feedbackMessage);

            IList <FeedbackMessage> infoMessages = store.GetFeedbackMessages(FeedbackMessageLevel.INFO);

            Assert.AreEqual(1, infoMessages.Count);
            Assert.IsTrue(infoMessages.Contains(feedbackMessage));

            IList <FeedbackMessage> errorMessages = store.GetFeedbackMessages(FeedbackMessageLevel.ERROR);

            Assert.AreEqual(0, errorMessages.Count);
        }
        public void TestCleanRendered()
        {
            InitializeHttpContext();

            var store = new FeedbackMessageStore();

            Assert.IsFalse(store.HasUnrenderedMessage());


            var infoMessage1 = FeedbackMessage.Info("Test warn message1");

            store.AddMessage(infoMessage1);
            var infoMessage2 = FeedbackMessage.Info("Test warn message2");

            store.AddMessage(infoMessage2);
            var infoMessage3 = FeedbackMessage.Info("Test warn message3");

            store.AddMessage(infoMessage3);

            store.CleanRendered();

            var infoMessages = store.GetFeedbackMessages(FeedbackMessageLevel.INFO);

            Assert.AreEqual(3, infoMessages.Count);

            infoMessage1.MarkRendered();
            infoMessage2.MarkRendered();
            store.CleanRendered();

            var infoMessagesCleanedRendered = store.GetFeedbackMessages(FeedbackMessageLevel.INFO);

            Assert.AreEqual(1, infoMessagesCleanedRendered.Count);
            Assert.IsTrue(infoMessagesCleanedRendered.Contains(infoMessage3));

            infoMessage3.MarkRendered();
            store.CleanRendered();

            Assert.IsFalse(store.HasUnrenderedMessage());
        }