public void ClientNotification_Serialization() { //Arrange var controller = new NullController(); controller.InjectDependencies(new FakeBackOfficeRequestContext(new FakeRebelApplicationContext(false))); var notifications = new ClientNotifications(controller.ControllerContext); var msg1 = new NotificationMessage("hello", "world"); var msg2 = new NotificationMessage("world", NotificationType.Error); var msg3 = new NotificationMessage("good", NotificationType.Warning); var msg4 = new NotificationMessage("bye", NotificationType.Success); //Act notifications.Add(msg1); notifications.Add(msg2); notifications.Add(msg3); notifications.Add(msg4); //Assert var serializeed = notifications.ToJsonString(); Assert.AreEqual(@"[{""id"":""" + msg1.Id.ToString("N") + @""",""message"":""hello"",""title"":""world"",""type"":""info""},{""id"":""" + msg2.Id.ToString("N") + @""",""message"":""world"",""title"":"""",""type"":""error""},{""id"":""" + msg3.Id.ToString("N") + @""",""message"":""good"",""title"":"""",""type"":""warning""},{""id"":""" + msg4.Id.ToString("N") + @""",""message"":""bye"",""title"":"""",""type"":""success""}]", serializeed); }
public void ClientNotification_Unique_Messages_Only() { //Arrange var controller = new NullController(); controller.InjectDependencies(new FakeBackOfficeRequestContext(new FakeRebelApplicationContext(false))); var notifications = new ClientNotifications(controller.ControllerContext); var msg = new NotificationMessage("hello"); //Act notifications.Add(msg); notifications.Add(msg); }
public void ClientNotification_Message_Added() { //Arrange var controller = new NullController(); controller.InjectDependencies(new FakeBackOfficeRequestContext(new FakeRebelApplicationContext(false))); var notifications = new ClientNotifications(controller.ControllerContext); var msg = new NotificationMessage("hello"); //Act notifications.Add(msg); //Assert Assert.AreEqual(1, notifications.Count()); }