public void GetFlashMessages_returns_a_collection() { TempDataDictionary tempData = new TempDataDictionary(); var original = new FlashMessageCollection(tempData); original.Add(new FlashMessage("info", "Hello, World!")); var flashMessages = tempData.GetFlashMessages(); Assert.AreEqual(1, flashMessages.Count()); }
public void GetFlashMessages_returns_a_new_collection_when_not_assigned() { TempDataDictionary tempData = new TempDataDictionary(); var flashMessages = tempData.GetFlashMessages(); Assert.AreEqual(0, flashMessages.Count()); }
public static bool HasFlashMessages(this TempDataDictionary dictionary) { var messages = dictionary.GetFlashMessages(); return(!messages.IsNullOrEmpty()); }
public static bool HasErrorMessage(this TempDataDictionary dictionary) { return(dictionary.GetFlashMessages().Any(m => m.Type == MessageType.Error)); }