public void UnrollFromSystem() { //Arrange DonorController donorController = new DonorController(); //Act testDonor = homeController.LoginAsDonor(testDonor.Email, testDonor.Password); donorController.Unroll(testDonor); //Assert Assert.IsTrue(homeController.LoginAsDonor(testDonor.Email, testDonor.Password) == null); }
public void RegisterAsDonorTest() { //Arrange DonorController donorController = new DonorController(); HomeController homeController = new HomeController(); string name = "Ralitsa Mladenova"; string email = "*****@*****.**"; string password = "******"; string phoneNumber = "0888654321"; string status = "Available"; string bloodGroup = "0+"; //Act bool expected = homeController.RegisterAsDonor(email, password, name, phoneNumber, status, bloodGroup); Donor donor = homeController.LoginAsDonor(email, password); //Assert Assert.IsTrue(expected && donor != null); //Clean-Up donorController.Unroll(donor); }
/// <summary>Shows the donor menu and checks if donor's blood has been received and redirects.</summary> /// <param name="donor">The donor.</param> private void ShowDonorMenu(Donor donor) { Console.WriteLine($"Login successful! Welcome {donor.Name}."); if (donor.Status != "Available") { Console.WriteLine($"Congratulations! {donor.Status} accepted your generous gesture and you donated your blood to them."); 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); switch (command) { case 1: donorController.Enroll(donor); Console.WriteLine("You've successfully enrolled in the program again. "); break; case 2: donorController.Unroll(donor); Console.WriteLine("You've successfully unrolled from the program. You may return back at any time."); break; } } else { Console.WriteLine("You are enrolled in the program. Patients will connect with you soon."); } }