Exemplo n.º 1
0
        public void HourOnTest()
        {
            DateTime dateTimeDb     = DateTime.Now;
            DateTime dateTimeCancel = dateTimeDb.AddHours(-24);

            CancelerService cancelerAppointment = new CancelerService();
            var             isValid             = cancelerAppointment.IsValidToCancel(dateTimeDb, dateTimeCancel);

            Assert.IsTrue(isValid);
        }
Exemplo n.º 2
0
        public void HourAfterTest()
        {
            DateTime dateTimeDb     = DateTime.Now;
            DateTime dateTimeCancel = DateTime.Now.AddHours(1);

            CancelerService cancelerAppointment = new CancelerService();
            var             isValid             = cancelerAppointment.IsValidToCancel(dateTimeDb, dateTimeCancel);

            Assert.IsFalse(isValid);
        }
Exemplo n.º 3
0
        public void HourBeforeTest()
        {
            // Arrange
            DateTime dateTimeDb     = DateTime.Now;
            DateTime dateTimeCancel = dateTimeDb.AddHours(-30);

            // Act
            CancelerService cancelerAppointment = new CancelerService();
            var             isValid             = cancelerAppointment.IsValidToCancel(dateTimeDb, dateTimeCancel);

            // Assert
            Assert.IsTrue(isValid);
        }
Exemplo n.º 4
0
        public ActionResult CancelConfirmed(Guid id)
        {
            CancelerService cancelerService = new CancelerService();

            if (cancelerService.Cancel(id, DateTime.Now))
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Las citas se deben cancelar 24 horas antes."));
            }
        }