public void DonorInteractions(Donors donor)
        {
            Console.WriteLine($"Congratulations! {donor.Status} accepted your generous gesture and you donated your blood to him.");
            Console.WriteLine("Do you wish to enroll to donate blood again or leave the blood donation program?");
            Console.WriteLine("1. I wish to enroll again.");
            Console.WriteLine("2. I want to leave the program.");

            int command = 0;

            do
            {
                if (!int.TryParse(Console.ReadLine(), out command))
                {
                    throw new FormatException("Value must be an integer.");
                }
            } while (command != 1 && command != 2);

            if (command == 1)
            {
                donorsDAO.ChangeDonorStatus(donor);
                Console.WriteLine("You've successfully enrolled in the program again. ");
                Console.WriteLine("Press any key to return to the main menu.");
                Console.ReadKey();
            }
            else
            {
                donorsDAO.DeleteDonor(donor);
                Console.WriteLine("You've successfully unenrolled from the program. You may return back at any time.");
                Console.WriteLine("Press any key to return to the main menu.");
                Console.ReadKey();
            }
        }
示例#2
0
        public void ChangeDonorStatusTest()
        {
            //Arrange
            HomeDAO homeDAO = new HomeDAO();

            DonorsDAO donorsDAO = new DonorsDAO();
            string    email     = "*****@*****.**";
            string    password  = "******";
            string    expected  = "Available";

            //Act
            Donor donor = homeDAO.DonorLogin(email, password);

            donorsDAO.ChangeDonorStatus(donor);

            //Assert
            Assert.AreEqual(expected, donor.Status);
        }
 /// <summary>Enrolls the specified donor and changes their status back to Available.</summary>
 /// <param name="donor">The donor.</param>
 public void Enroll(Donor donor)
 {
     donorsDAO.ChangeDonorStatus(donor);
 }