Ejemplo n.º 1
0
        public void CanTheUserBeInvitedToAppointment_UserNameAndAppointment_ReturnsTrue()
        {
            // Arrange
            string        userNameInput = "Juan";
            DateTime      appointmentDefaultStartDate = new DateTime(2020, 8, 10, 20, 34, 11);
            DateTime      appointmentDefaultEndDate   = new DateTime(2020, 8, 11, 7, 12, 56);
            List <string> guestUserNames = new List <string> {
                "Ignacio", "Antonia", userNameInput
            };
            Appointment defaultAppointment = new Appointment("Title", "Description", appointmentDefaultStartDate, appointmentDefaultEndDate, "Diego", guestUserNames);

            appointmentController.Appointments = new List <Appointment> {
                defaultAppointment
            };

            DateTime      appointmentInDoubtStartDate        = new DateTime(2020, 8, 11, 8, 44, 10);
            DateTime      appointmentInDoubtEndDate          = new DateTime(2020, 8, 11, 13, 52, 36);
            List <string> guestUserNamesOfAppointmentInDoubt = new List <string>();
            Appointment   appointmentInDoubt = new Appointment("Title", "Description", appointmentInDoubtStartDate, appointmentInDoubtEndDate, "Alberto", guestUserNamesOfAppointmentInDoubt);

            // Act
            bool result = appointmentController.CanTheUserBeInvitedToAppointment(userNameInput, appointmentInDoubt);

            // Assert
            Assert.IsTrue(result, string.Format("The user {0} cannot be invited to the appointment {1} due to a time collision", userNameInput, appointmentInDoubt.Title));
        }