public void UpdateResponsible() { //Prueba la asigna un responsable a la donación //Creación del donador, un empleado (persona), la donación y el voluntario DonorBM donor = create_donor(); PersonBM personBm = create_person(); DonationStatusBM statusBm = get_status(1); DonationBLL donationBll = new DonationBLL(); DonationBM donationBm = new DonationBM(3, donor.donorId, statusBm, "Esta es una donación creada por un test."); ResultBM donationResult = donationBll.SaveDonation(donationBm); BranchBLL branchBll = new BranchBLL(); ResultBM branchResult = branchBll.GetBranch(1); VolunteerBLL volunteerBll = new VolunteerBLL(); VolunteerBM volunteerBm = new VolunteerBM(personBm, branchResult.GetValue <BranchBM>()); ResultBM volunterResult = volunteerBll.SaveVolunteer(volunteerBm); donationBm.volunteer = volunterResult.GetValue <VolunteerBM>(); ResultBM updateResult = donationBll.UpdateDonation(donationBm); Assert.IsTrue(updateResult.IsValid(), "La operación debería ser válida."); donationResult = donationBll.GetDonation(updateResult.GetValue <DonationBM>().id); Assert.IsTrue(donationResult.IsValid(), "La operación debería ser válida."); Assert.IsNotNull(donationResult.GetValue(), "Deería haber devuelto una donación."); Assert.IsNotNull(donationResult.GetValue <DonationBM>().volunteer, "Deería haber devuelto un voluntario."); Assert.AreEqual(donationResult.GetValue <DonationBM>().volunteer.volunteerId, volunterResult.GetValue <VolunteerBM>().volunteerId, "Debería ser el mismo voluntario."); }
public void CreateVolunteer() { //Crea un donador PersonBM personBm = create_person(); BranchBLL branchBll = new BranchBLL(); ResultBM brancResult = branchBll.GetBranch(1); Assert.IsTrue(brancResult.IsValid(), "El donador debería existir."); VolunteerBLL volunteerBll = new VolunteerBLL(); VolunteerBM volunteerBm = new VolunteerBM(personBm, brancResult.GetValue <BranchBM>()); ResultBM volunterResult = volunteerBll.SaveVolunteer(volunteerBm); Assert.IsTrue(volunterResult.IsValid(), "El donador debería existir."); Assert.IsNotNull(volunterResult.GetValue(), "Debería existir el voluntario."); Assert.IsTrue(volunterResult.GetValue <VolunteerBM>().id > 0, "Debería existir el voluntario."); }