Inheritance: sp_VolPhone_CON
Ejemplo n.º 1
0
        public static void InsertVolPhoneData(TestContext testContext)
        {
            System.Diagnostics.Debug.WriteLine(String.Format("{0}", DateTime.Now));
            cExcel.RemoveAllData();
            cExcel.InsertData(ExcelFilenames);

            sp_Volunteer_BLL volBLL = new sp_Volunteer_BLL();
            generalTestVol = new sp_Volunteer_DM();
            generalTestVol.VolFirstName = "TestFirst";
            generalTestVol.VolMiddleName = "TestMiddle";
            generalTestVol.VolLastName = "TestLast";
            generalTestVol.ActiveFlg = true;
            System.Guid volID = Guid.NewGuid();
            generalTestVol.VolID = volID;
            volBLL.InsertVolunteerContext(ref generalTestVol);

            sp_VolPhone_BLL volPhone_bll = new sp_VolPhone_BLL();
            primaryTestVolPhone = new sp_Phone_DM();
            primaryTestVolPhone.PhoneNbr = "1357924680";
            primaryTestVolPhone.VolID = volID;
            primaryTestVolPhone.ActiveFlg = true;
            primaryTestVolPhone.PrimaryFlg = true;
            volPhone_bll.InsertPhoneContext(primaryTestVolPhone);

            secondaryTestVolPhone = new sp_Phone_DM();
            secondaryTestVolPhone.PhoneNbr = "2468013579";
            secondaryTestVolPhone.VolID = volID;
            secondaryTestVolPhone.ActiveFlg = true;
            secondaryTestVolPhone.PrimaryFlg = false;
            volPhone_bll.InsertPhoneContext(secondaryTestVolPhone);
        }
Ejemplo n.º 2
0
        public List<sp_Phone_DM> hSelectVolPhone(sp_Phone_DM givenPhone)
        {
            List<sp_Phone_DM> PhoneList = new List<sp_Phone_DM>();
            sp_VolPhone_BLL VolPhoneBll = new sp_VolPhone_BLL();

            PhoneList = VolPhoneBll.ListPhones(givenPhone);
            return PhoneList;
        }
Ejemplo n.º 3
0
        public sp_Phone_DM hSelectPrimaryVolPhone(sp_Phone_DM givenPhone)
        {
            sp_Phone_DM Phone = new sp_Phone_DM();
            sp_VolPhone_BLL VolPhoneBll = new sp_VolPhone_BLL();

            Phone = VolPhoneBll.ListPrimaryPhone(givenPhone);
            return Phone;
        }
Ejemplo n.º 4
0
        public void hUpdateVolPhone(sp_Phone_DM Phone, string phoneNumber,bool primaryNumber)
        {
            sp_VolPhone_BLL VolPhoneBll = new sp_VolPhone_BLL();

            Phone.PhoneNbr = phoneNumber;
            Phone.PrimaryFlg = primaryNumber;

            VolPhoneBll.UpdatePhoneNbr(Phone);
        }
Ejemplo n.º 5
0
        public static void RemoveVolPhoneData()
        {
            sp_VolPhone_BLL volPhoneBLL = new sp_VolPhone_BLL();
            volPhoneBLL.DeletePhonesContext(secondaryTestVolPhone);
            volPhoneBLL.DeletePhonesContext(primaryTestVolPhone);
            if (createTestVolPhone != null)
                volPhoneBLL.DeletePhonesContext(createTestVolPhone);

            sp_Volunteer_BLL volBLL = new sp_Volunteer_BLL();
            volBLL.DeleteVolunteerContext(generalTestVol);
            if (createTestVol != null)
                volBLL.DeleteVolunteerContext(createTestVol);

            cExcel.RemoveData(ExcelFilenames);
        }
Ejemplo n.º 6
0
        public sp_Phone_DM hCreateVolPhone(string PhoneNbr,Guid VolID,bool primaryPhone,ref int numberPhones)
        {
            sp_Phone_DM Phone = new sp_Phone_DM();
            sp_VolPhone_BLL VolPhoneBll = new sp_VolPhone_BLL();

            numberPhones = numberPhones + 1;
            Phone.PhoneID = numberPhones;
            Phone.ActiveFlg = true;
            Phone.PhoneNbr = PhoneNbr;
            Phone.VolID = VolID;
            Phone.PrimaryFlg = primaryPhone;

            VolPhoneBll.InsertPhoneContext(Phone);

            return Phone;
        }
Ejemplo n.º 7
0
        public void TestVolPhoneCreate()
        {
            sp_Volunteer_BLL vol_bll = new sp_Volunteer_BLL();
            sp_Volunteer_DM vol_dm = new sp_Volunteer_DM();
            vol_dm.VolFirstName = "createFirst";
            vol_dm.VolMiddleName = "createMiddle";
            vol_dm.VolLastName = "createLast";
            vol_dm.ActiveFlg = true;
            System.Guid volID = vol_bll.InsertVolunteerContext(ref vol_dm).VolID;
            vol_dm.VolID = volID;

            string volPhoneNbr = "0123456789";
            bool PrimaryFlg = true;
            bool ActiveFlg = true;
            sp_VolPhone_BLL volPhone_bll = new sp_VolPhone_BLL();
            sp_Phone_DM volPhone_dm = new sp_Phone_DM();
            volPhone_dm.PhoneNbr = volPhoneNbr;
            volPhone_dm.VolID = volID;
            volPhone_dm.ActiveFlg = ActiveFlg;
            volPhone_dm.PrimaryFlg = PrimaryFlg;
            volPhone_bll.InsertPhoneContext(volPhone_dm);
            int volPhoneID = volPhone_dm.PhoneID;

            List<sp_Phone_DM> volPhoneDMs_selected = volPhone_bll.ListPhones(volPhone_dm);
            Assert.IsTrue(PhoneListContains(volPhoneDMs_selected, volPhone_dm));
        }
Ejemplo n.º 8
0
        public void TestVolPhoneUpdate()
        {
            sp_VolPhone_BLL volPhoneBLL = new sp_VolPhone_BLL();
            sp_Phone_DM updatePhone = volPhoneBLL.ListPrimaryPhone(primaryTestVolPhone);
            String newPhoneNbr = "9876543210";
            updatePhone.PhoneNbr = newPhoneNbr;
            volPhoneBLL.UpdatePhoneNbr(updatePhone);
            sp_Phone_DM selectedPhone = volPhoneBLL.ListPrimaryPhone(updatePhone);
            primaryTestVolPhone.PhoneNbr = newPhoneNbr;

            //To get all phones listed, create a new domain model with no phoneID specified.
            sp_Phone_DM selectAllPhones = new sp_Phone_DM();
            selectAllPhones.VolID = updatePhone.VolID;
            List<sp_Phone_DM> selectedPhoneList = volPhoneBLL.ListPhones(selectAllPhones);

            Assert.IsTrue(PhoneListContains(selectedPhoneList, updatePhone));
            Assert.IsTrue(PhoneListContains(selectedPhoneList, secondaryTestVolPhone));
            Assert.IsTrue(PhoneEquals(selectedPhone, updatePhone));
            Assert.AreEqual(newPhoneNbr, selectedPhone.PhoneNbr);
        }
Ejemplo n.º 9
0
        public void TestVolPhoneRead()
        {
            string helperDir = cExcel.GetHelperFilesDir();
            DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(helperDir, "VolPhone.xlsx"));
            List<sp_Phone_DM> excelDMs = getVolPhoneDMs(dt);
            sp_VolPhone_BLL volPhone_bll = new sp_VolPhone_BLL();

            foreach (sp_Phone_DM testVolPhone in excelDMs)
            {
                List<sp_Phone_DM> selectedVolPhones = volPhone_bll.ListPhones(testVolPhone);
                Assert.IsTrue(PhoneListContains(selectedVolPhones, testVolPhone));
            }
        }
Ejemplo n.º 10
0
        public void TestVolPhonePrimaryRead()
        {
            sp_VolPhone_BLL volPhoneBLL = new sp_VolPhone_BLL();
            sp_Phone_DM volPhoneDM_selected = volPhoneBLL.ListPrimaryPhone(primaryTestVolPhone);
            Assert.IsTrue(PhoneEquals(primaryTestVolPhone, volPhoneDM_selected));

            volPhoneDM_selected = volPhoneBLL.ListPrimaryPhone(secondaryTestVolPhone);
            Assert.IsTrue(PhoneEquals(primaryTestVolPhone, volPhoneDM_selected));
        }
Ejemplo n.º 11
0
        public void TestVolPhoneDelete()
        {
            sp_VolPhone_BLL volPhone_bll = new sp_VolPhone_BLL();
            //Can't delete primary
            volPhone_bll.DeletePhonesContext(secondaryTestVolPhone);
            sp_Phone_DM selectedVolPhone = volPhone_bll.ListPhones(secondaryTestVolPhone).First();
            secondaryTestVolPhone.ActiveFlg = false;

            Assert.IsNotNull(selectedVolPhone.ActiveFlg);
            Assert.IsFalse(selectedVolPhone.ActiveFlg == true);
            Assert.IsTrue(selectedVolPhone.ActiveFlg == false);
        }
Ejemplo n.º 12
0
        public void hDeleteVolPhone(sp_Phone_DM Phone)
        {
            sp_VolPhone_BLL VolPhoneBll = new sp_VolPhone_BLL();

            VolPhoneBll.DeletePhonesContext(Phone);
        }