Example #1
0
        public void AddError_Message()
        {
            container.AddError("Message");

            Alert actual = container.Single();

            Assert.Equal(AlertType.Danger, actual.Type);
            Assert.Equal("Message", actual.Message);
            Assert.Equal(0, actual.FadeoutAfter);
        }
Example #2
0
        public void AddError_AddsErrorMessage()
        {
            alerts.AddError("ErrorMessage");

            Alert actual = alerts.Single();

            Assert.AreEqual(AlertTypes.Danger, actual.Type);
            Assert.AreEqual("ErrorMessage", actual.Message);
            Assert.AreEqual(0, actual.FadeoutAfter);
        }
        public void Merge_Alerts()
        {
            AlertsContainer part = new AlertsContainer();

            container.AddError("FirstError");
            part.AddError("SecondError");

            IEnumerable <Alert> expected = container.Union(part);
            IEnumerable <Alert> actual   = container;

            container.Merge(part);

            Assert.Equal(expected, actual);
        }
Example #4
0
        public void OnActionExecuted_MergesTempDataAlerts()
        {
            AlertsContainer alerts = new AlertsContainer();

            alerts.AddError("Test1");

            controller.TempData["Alerts"] = JsonConvert.SerializeObject(alerts);

            controller.Alerts.AddError("Test2");
            alerts.AddError("Test2");

            controller.OnActionExecuted(null);

            Object expected = JsonConvert.SerializeObject(alerts);
            Object actual   = controller.TempData["Alerts"];

            Assert.Equal(expected, actual);
        }
Example #5
0
        public void Merge_MergesAlerts()
        {
            AlertsContainer part = new AlertsContainer();

            alerts.AddError("FirstError");
            part.AddError("SecondError");

            IEnumerable expected = alerts.ToList().Union(part);
            IEnumerable actual   = alerts;

            alerts.Merge(part);

            CollectionAssert.AreEqual(expected, actual);
        }
Example #6
0
        public void OnActionExecuted_MergesTempDataAlerts()
        {
            AlertsContainer alerts = new AlertsContainer();

            alerts.AddError("Test1");

            controller.TempData["Alerts"] = alerts;

            controller.Alerts.AddError("Test2");

            alerts = new AlertsContainer();
            alerts.Merge((AlertsContainer)controller.TempData["Alerts"]);
            alerts.Merge(controller.Alerts);

            ((IActionFilter)controller).OnActionExecuted(new ActionExecutedContext());

            IEnumerable <Alert> actual   = (AlertsContainer)controller.TempData["Alerts"];
            IEnumerable <Alert> expected = alerts;

            Assert.Equal(expected, actual);
        }
        public void Merge_Alerts()
        {
            AlertsContainer part = new AlertsContainer();
            container.AddError("FirstError");
            part.AddError("SecondError");

            IEnumerable<Alert> expected = container.Union(part);
            IEnumerable<Alert> actual = container;
            container.Merge(part);

            Assert.Equal(expected, actual);
        }
        public void OnActionExecuted_MergesTempDataAlerts()
        {
            AlertsContainer alerts = new AlertsContainer();
            alerts.AddError("Test1");

            controller.TempData["Alerts"] = JsonConvert.SerializeObject(alerts);

            controller.Alerts.AddError("Test2");
            alerts.AddError("Test2");

            controller.OnActionExecuted(null);

            Object expected = JsonConvert.SerializeObject(alerts);
            Object actual = controller.TempData["Alerts"];

            Assert.Equal(expected, actual);
        }