Example #1
0
        private ActionResult UpdateAppointmentStatus(UpdateAppointmentCommand command)
        {
            var handler = new UpdateAppointmentCommandHandler(Context);

            handler.Handle(command);

            return(RedirectToAction("OnProperty", new { id = command.PropertyId }));
        }
        public async void AppointmentShouldUpdateCorrect()
        {
            var updatedAppointment = new UpdateAppointmentCommand
            {
                Id = appointmentId,
                ReservationDate = new DateTime(2019, 09, 09),
                TimeBlockHelper = GConst.ValidHour,
                EmployeeId      = employeeId,
                ServiceId       = serviceId
            };

            var status = Task <Unit> .FromResult(await sut.Handle(updatedAppointment, CancellationToken.None));

            var resultId = context.Appointments.SingleOrDefault(x => x.TimeBlockHelper == GConst.ValidHour).Id;

            Assert.Equal(appointmentId, resultId);
            Assert.Equal(GConst.SuccessStatus, status.Status.ToString());
            Assert.Equal(GConst.ValidCount, context.Appointments.Count());
        }