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(); } }
public void DonorRegisterTest() { //Arrange DonorsDAO donorsDAO = new DonorsDAO(); HomeDAO homeDAO = new HomeDAO(); Donor donor = new Donor(); donor.DonorId = 7; donor.Name = "Ralitsa Mladenova"; donor.Email = "*****@*****.**"; donor.Password = "******"; donor.PhoneNumber = "0888654321"; donor.Status = "Available"; donor.BloodGroup = "0+"; //Act bool result = homeDAO.DonorRegister(donor); //Assert Assert.IsTrue(result); //Clean-Up donorsDAO.DeleteDonor(donor); }
public void DeleteDonorFromSystemTest() { //Arrange HomeDAO homeDAO = new HomeDAO(); DonorsDAO donorsDAO = new DonorsDAO(); Donor testDonor = new Donor(); testDonor.DonorId = 101; testDonor.Name = "Test Donor 1"; testDonor.Email = "*****@*****.**"; testDonor.Password = "******"; testDonor.PhoneNumber = "0888123456"; testDonor.Status = null; testDonor.BloodGroup = "B-"; //Act homeDAO.DonorRegister(testDonor); donorsDAO.DeleteDonor(testDonor); //Assert Assert.IsTrue(homeDAO.DonorLogin(testDonor.Email, testDonor.Password) == null); }
/// <summary>Unrolls the specified donor and deletes them from the system.</summary> /// <param name="donor">The donor.</param> public void Unroll(Donor donor) { donorsDAO.DeleteDonor(donor); }