コード例 #1
0
        public void CanCreateFlashMessage()
        {
            var flashMessage = new FlashMessage("Attention", "This is a message", FlashMessageType.Info);

            Assert.AreEqual("Attention", flashMessage.Title);
            Assert.AreEqual("This is a message", flashMessage.Message);
            Assert.AreEqual(FlashMessageType.Info, flashMessage.Type);
        }
コード例 #2
0
        private static string GetCssClass(FlashMessage flashMessage)
        {
            // Default to info css class
            var cssClass = "message-info";

            // Determine class name based on message type
            switch (flashMessage.Type)
            {
                case FlashMessageType.Info:
                    cssClass = "alert alert-info alert-block";
                    break;
                case FlashMessageType.Success:
                    cssClass = "alert alert-success alert-block";
                    break;
                case FlashMessageType.Warning:
                    cssClass = "alert alert-block";
                    break;
                case FlashMessageType.Error:
                    cssClass = "alert alert-danger alert-block";
                    break;
            }
            return cssClass;
        }