public void AppendAlertWithNullControllerArgument_ShouldThrowException()
        {
            ControllerBase controllerBase = null;
            AlertDetail alert = new AlertDetail();
            AlertManager.AppendAlert(controllerBase, alert);

            Assert.Fail("Should have thrown ArgumentNullException.");
        }
        public void ConstructorWithNoArgumentsVerifyDefaults_ReturnsInstance()
        {
            AlertDetail instance = new AlertDetail();

            Assert.AreEqual(instance.Severity , AlertSeverity.Info);
            Assert.AreEqual(instance.AlertMessage , "No message set.");
            Assert.AreEqual(instance.AutoDismissTime , new TimeSpan(0));
            Assert.AreEqual(instance.ShowDismissButton , true);
            Assert.AreEqual(instance.EnableCrossView , false);
        }
        public void AppendAlertWithTempDataAlert_ShouldSaveToQueue()
        {
            Int32 expected = 1;
            Int32 actual = 0;
            ControllerBase controllerBase = new MockController();
            AlertDetail alert = new AlertDetail() { AlertMessage = "Unit Test", EnableCrossView = true };
            AlertManager.AppendAlert(controllerBase, alert);

            Assert.IsNotNull(controllerBase.TempData["CouncilSoft.BootstrapAlerts"]);

            Queue<AlertDetail> queue = controllerBase.TempData["CouncilSoft.BootstrapAlerts"] as Queue<AlertDetail>;

            Assert.IsNotNull(queue);

            actual = queue.Count;

            Assert.AreEqual(expected, actual);
        }
Beispiel #4
0
        public ActionResult UpdateAlertDetail(AlertDetail alertDetail)
        {
            string retValue = string.Empty;

            if (alertDetail != null)
            {
                using (var service = new TowTruckServiceClient())
                {
                    if (alertDetail.IsExcused)
                    {
                        service.ExcuseAlarm(alertDetail.VehicleNumber, alertDetail.AlarmType, HttpContext.User.Identity.Name, alertDetail.AlertId, alertDetail.Comments);
                        retValue = "Thank you! Alarm successfully excused";
                    }
                    else
                    {
                        service.UnexcuseAlarm(alertDetail.VehicleNumber, alertDetail.BeatNumber.ToString(), alertDetail.AlarmType, alertDetail.DriverName, alertDetail.Comments);
                        retValue = "Thank you! Alarm successfully un-excused";
                    }
                }
            }

            return(Json(retValue, JsonRequestBehavior.AllowGet));
        }
        public void ConstructorWithNoArguments_ReturnsInstance()
        {
            AlertDetail instance = new AlertDetail();

            Assert.IsNotNull(instance);
        }