Inheritance: sp_ContactEmail_CON
Exemplo n.º 1
0
        public void TestContactEmailCreate()
        {
            //Insert a Contact First
            sp_Contact_DM contact_dm = new sp_Contact_DM();
            contact_dm.ContactID = new Guid();
            sp_Contact_BLL contact_bll = new sp_Contact_BLL();
            contact_bll.InsertContactContext(ref contact_dm);

            //Insert an ContactEmail
            sp_ContactEmail_DM data = new sp_ContactEmail_DM();
            data.ContactID = contact_dm.ContactID;
            data.EmailID = 1;
            data.PrimaryEmail = true;
            sp_ContactEmail_BLL vendor = new sp_ContactEmail_BLL();
            vendor.InsertContactEmailContext(data);
            var newdata = vendor.ListContactEmails(data.ContactID, data.EmailID);
            Assert.AreEqual(data.ContactID, newdata.ContactID, "Contact ID Not Set As Expected");
            Assert.AreEqual(data.EmailID, newdata.EmailID, "Email ID Not Set As Expected");
            Assert.AreEqual(data.PrimaryEmail, newdata.PrimaryEmail, "PrimaryEmail Not Set As Expected");
        }
Exemplo n.º 2
0
        public void TestContactEmailRead()
        {
            DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(cExcel.GetHelperFilesDir(), "ContactEmail.xlsx"));
                foreach (DataRow row in dt.Rows) // Loop over the rows.
                {
                    Guid contactID = new Guid(row["ContactID"].ToString());
                    int emailID = Convert.ToInt32(row["EmailID"]);
                    sp_ContactEmail_BLL contact = new sp_ContactEmail_BLL();

                    var data = contact.ListContactEmails(contactID, emailID);
                    Assert.AreEqual(contactID, data.ContactID, "ContactID Not Set As Expected");
                    Assert.AreEqual(emailID, data.EmailID, "EmailID Not Set As Expected");
                }
        }
Exemplo n.º 3
0
        public void TestContactEmailUpdate()
        {
            //Test Our Read
            DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(cExcel.GetHelperFilesDir(), "ContactEmail.xlsx"));
            foreach (DataRow row in dt.Rows) // Loop over the rows.
            {
                bool primaryEmail = true;
                int emailID = Convert.ToInt32(row["EmailID"]);
                Guid contactID = new Guid( row["ContactID"].ToString());
                sp_ContactEmail_DM data = new sp_ContactEmail_DM();
                data.ContactID = contactID;
                data.EmailID = emailID;
                data.PrimaryEmail = primaryEmail;
                sp_ContactEmail_BLL contact = new sp_ContactEmail_BLL();
                contact.UpdateContactEmailContext(data);
                var newdata = contact.ListContactEmails(contactID, emailID);
                Assert.AreEqual(primaryEmail, newdata.PrimaryEmail, "PrimaryEmail Not Set As Expected");
                Assert.AreEqual(emailID, newdata.EmailID, "EmailID Not Set As Expected");
                Assert.AreEqual(contactID, newdata.ContactID, "ContactIDe Not Set As Expected");

            }
        }
Exemplo n.º 4
0
        public void TestContactEmailReadAll()
        {
            //Pull our data from the excel file
            string helperDir = cExcel.GetHelperFilesDir();
            DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(helperDir, "ContactEmail.xlsx"));
            //Pull our data directly from the DB
            var numRows = cExcel.getNumRecordsFromDB("[Vend].[tblContactEmail]");

            //Pull our data from the DB through the BLL
            sp_ContactEmail_BLL contactEmails = new sp_ContactEmail_BLL();
            var allContactsEmails = contactEmails.ListContactEmails();

            //Test the data from the BLL
            Assert.AreEqual(numRows, allContactsEmails.Count);
        }