예제 #1
0
        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_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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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());
        }
        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());
        }
        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);

          
        }