////public constructor
        public clsEmailAddressCollection()
        {
            //instance of the database connection class
            clsDataConnection DB = new clsDataConnection();

            //exectue the stored procedure
            DB.Execute("sproc_tblEmailAddress_SelectAll");
            //get the count
            Int32 RecordCount = DB.Count;
            //set up index for the loop
            Int32 Index = 0;

            //while there are records to process
            while (Index < RecordCount)
            {
                //create a new instance of the email class
                clsEmail AEmailAddress = new clsEmail();
                //get the email Address
                AEmailAddress.EmailAddress = DB.DataTable.Rows[Index]["EmailAddress"].ToString();
                //get the primary key
                AEmailAddress.EmailAddressNo = Convert.ToInt32(DB.DataTable.Rows[Index]["EmailAddressNo"]);
                //add the Email to the private data
                allEmailAddresses.Add(AEmailAddress);
                //add to the index
                Index++;
            }
        }
Ejemplo n.º 2
0
 public void EmailInstanceOK()
 {
     //instance of clsEmail
     clsEmail AEmail = new clsEmail();
     //check if not null
     Assert.IsNotNull(AEmail);
 }
 //public constructor
 public clsEmailCollection()
 {
     //instance of the database connection class
     clsDataConnection DB = new clsDataConnection();
     //exectue the stored procedure
     DB.Execute("sproc_tblEmail_SelectAll");
     //get the count
     Int32 RecordCount = DB.Count;
     //set up index for the loop
     Int32 Index = 0;
     //while there are records to process
     while (Index < RecordCount)
     {
         //create a new instance of the email class
         clsEmail AEmail = new clsEmail();
         //get the email subject
         AEmail.EmailSubject = DB.DataTable.Rows[Index]["EmailSubject"].ToString();
         //get the primary key
         AEmail.EmailNo = Convert.ToInt32(DB.DataTable.Rows[Index]["EmailNo"]);
         //get the email Content
         AEmail.EmailContent = DB.DataTable.Rows[Index]["EmailContent"].ToString();
         //get the email address recieving
         AEmail.EmailAddressNo = Convert.ToInt32(DB.DataTable.Rows[Index]["EmailAddressNo"]);
         //passess the EmailAddressNo to get the EmailAddress
         AEmail.EmailAddress = GetEmailAddress(AEmail.EmailAddressNo);
         //add the Email to the private data
         allEmails.Add(AEmail);
         //add to the index
         Index++;
     }
 }
Ejemplo n.º 4
0
 public void TimeStampOK()
 {
     //instance of the clsEmail
     clsEmail TestEmail = new clsEmail();
     //put in some test data
     DateTime TestData = new DateTime(25 / 07 / 2012);
     //assign the data to the property
     TestEmail.EmailTimeStamp = TestData;
     //check to see the data is equal
     Assert.AreEqual(TestEmail.EmailTimeStamp, TestData);
 }
Ejemplo n.º 5
0
 public void EmailAddressOK()
 {
     //instance of clsEmail
     clsEmail AEmail = new clsEmail();
     //test data to the property
     string SomeEmailAddress = "*****@*****.**";
     //assign the data to the property
     AEmail.EmailAddress = SomeEmailAddress;
     //test the data to see the two are equal
     Assert.AreEqual(AEmail.EmailAddress, SomeEmailAddress);
 }
Ejemplo n.º 6
0
 public void EmailAddressNoOK()
 {
     //instance of clsEmail
     clsEmail AEmail = new clsEmail();
     //test data to the property
     Int32 SomeEmailAddressNo = 1;
     //assign the data to the property
     AEmail.EmailAddressNo = SomeEmailAddressNo;
     //test the data to see the two are equal
     Assert.AreEqual(AEmail.EmailAddressNo, SomeEmailAddressNo);
 }
Ejemplo n.º 7
0
 public void EmailAddressMinLessOne()
 {
     //instance of the clsEmail
     clsEmail TestEmail = new clsEmail();
     //test data to store result of validation
     Boolean OK;
     //test data to the property
     OK = TestEmail.Valid("");
     //check to see if result is ok
     Assert.IsFalse(OK);
 }
Ejemplo n.º 8
0
 public void ViewArchiveEmail(int EmailAddressNo, int ArchiveNo)
 {
     clsEmail OneEmail = new clsEmail();
     clsEmailCollection AllEmails = new clsEmailCollection();
     EmailAddress = AllEmails.GetEmailAddress(EmailAddressNo);
     bool IsArchive = true;
     AllEmails.GetOneEmail(ArchiveNo, IsArchive, out EmailSubject, out EmailContent);
     txtBxSubject.Text = EmailSubject;
     txtBxContent.Text = EmailContent;
     txtBxFrom.Text = EmailAddress;
 }
Ejemplo n.º 9
0
 //this will be the function that shows the new email and it accepts the emailno selected in 
 //the datagridview
 public void NewEmail(int EmailAddressNo, int EmailNo)
 {
     //txtBxFrom.Text = Convert.ToString(EmailAddressNo);
     clsEmail OneEmail = new clsEmail();
     clsEmailCollection AllEmails = new clsEmailCollection();
     EmailAddress = AllEmails.GetEmailAddress(EmailAddressNo);
     bool IsArchive = false;
     AllEmails.GetOneEmail(EmailNo, IsArchive, out EmailSubject, out EmailContent);
     txtBxSubject.Text = EmailSubject;
     txtBxContent.Text = EmailContent;
     txtBxFrom.Text = EmailAddress;
 }
Ejemplo n.º 10
0
 public void EmailValidMethodOK()
 {
     //instance of clsEmail
     clsEmail AEmail = new clsEmail();
     //test data to store result of validation
     Boolean OK = false;
     //assign the data to the property
     string SomeEmail = "*****@*****.**";
     //invoke the method
     OK = AEmail.Valid(SomeEmail);
     //check to see if result is ok
     Assert.IsTrue(OK);
 }
 public void AllEmailsOK()
 {
     //create instance of the class
     clsEmailAddressCollection Emails = new clsEmailAddressCollection();
     //create some test data
     List<clsEmail> TestList = new List<clsEmail>();
     //add an item to the list
     clsEmail TestItem = new clsEmail();
     //set the properties
     TestItem.EmailAddressNo = 1;
     TestItem.EmailAddress = "*****@*****.**";
     //add the item to the test list
     TestList.Add(TestItem);
     //assign the data
     Emails.AllEmailAddresses = TestList;
     //test to see that the two are the same
     Assert.AreEqual(Emails.AllEmailAddresses, TestList);
 }
        public void ListEmailsAndCountOK()
        {
            //create an instance of the class we want to create
            clsEmailCollection AllAddresses = new clsEmailCollection();
            //create some test data to assign to the property
            //in this case the data needs to be a list of objects
            List<clsEmail> TestList = new List<clsEmail>();
            //add an item to the list
            //create the item of test data
            clsEmail TestItem = new clsEmail();
            //set its properties
            TestItem.EmailAddress = "*****@*****.**";
            TestItem.EmailAddressNo = 1;
            TestItem.EmailSubject = "blahblah";
            TestItem.EmailContent = "blahblahblahblah";
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AllAddresses.AllEmails = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(AllAddresses.CountEmails, TestList.Count);

        }
Ejemplo n.º 13
0
 public void TimeStampMinLessOne()
 {
     //instance of the clsEmail
     clsEmail TestEmail = new clsEmail();
     //test data to store result of validation
     Boolean OK;
     //test data to the property
     OK = TestEmail.TimeStampValid("1985");
     Assert.IsFalse(OK);
 }
Ejemplo n.º 14
0
 public void EmailContentOK()
 {
     //create an instance of the class
     clsEmail AnEmail = new clsEmail();
     ///create some test data
     String testData = "skslskslkslk";
     //test data to the property
     AnEmail.EmailContent = testData;
     //check to see if ok
     Assert.AreEqual(AnEmail.EmailContent, testData);
 }
Ejemplo n.º 15
0
 public void EmailAddressWithoutAt()
 {
     //instance of the clsEmail
     clsEmail TestEmail = new clsEmail();
     //test data to store result of validation
     Boolean OK;
     //test data to the property
     OK = TestEmail.Valid("mulgrewaaron1gmail.com");
     //check to see if result is ok
     Assert.IsFalse(OK);
 }
Ejemplo n.º 16
0
 public void TimeStampMax()
 {
     //instance of the clsEmail
     clsEmail TestEmail = new clsEmail();
     //test data to store result of validation
     Boolean OK;
     OK = TestEmail.TimeStampValid("2016");
     //check to see if result is ok
     Assert.IsTrue(OK);
 }
Ejemplo n.º 17
0
 public void TimeStampMaxInvalidData()
 {
     //instance of the clsEmail
     clsEmail TestEmail = new clsEmail();
     //test data to store result of validation
     Boolean OK;
     //test data to the property
     OK = TestEmail.TimeStampValid("101010101");
     //check to see if result is ok
     Assert.IsFalse(OK);
 }
Ejemplo n.º 18
0
 public void EmailSubjectMinLessOne()
 {
     //instance of the clsEmail
     clsEmail TestEmail = new clsEmail();
     //test data to store result of validation
     Boolean OK;
     //test data to the property
     OK = TestEmail.EmailSubjectValid("Aa");
     Assert.IsFalse(OK);
 }
Ejemplo n.º 19
0
 public void EmailSubjectExtremeMax()
 {
     //instance of the clsEmail
     clsEmail TestEmail = new clsEmail();
     //test data to store result of validation
     Boolean OK;
     //test data to the property
     OK = TestEmail.EmailSubjectValid("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
     //check to see if result is ok
     Assert.IsFalse(OK);
 }
Ejemplo n.º 20
0
 public void EmailAddressMid()
 {
     //instance of the clsEmail
     clsEmail TestEmail = new clsEmail();
     //test data to store result of validation
     Boolean OK;
     //test data to the property
     OK = TestEmail.Valid("*****@*****.**");
     //check to see if result is ok
     Assert.IsTrue(OK);
 }
Ejemplo n.º 21
0
 public void EmailSubjectOK()
 {
     //create an instance of the class
     clsEmail AnEmail = new clsEmail();
     ///create some test data (the current date)
     String testData = "blahblahblah";
     //test data to the property
     AnEmail.EmailSubject = testData;
     //check to see if ok
     Assert.AreEqual(AnEmail.EmailSubject, testData);
 }
Ejemplo n.º 22
0
 public void EmailTimeStampOK()
 {
     //create an instance of the class
     clsEmail AnEmail = new clsEmail();
     ///create some test data (the current date)
     DateTime testData = DateTime.Now.Date;
     //test data to the property
     AnEmail.EmailTimeStamp = testData;
     //check to see if ok
     Assert.AreEqual(AnEmail.EmailTimeStamp, testData);
 }
Ejemplo n.º 23
0
 public void EmailAddressExtreme()
 {
     //instance of the clsEmail
     clsEmail TestEmail = new clsEmail();
     //test data to store result of validation
     Boolean OK;
     //test data to the property
     OK = TestEmail.Valid("*****@*****.**");
     //check to see if result is ok
     Assert.IsFalse(OK);
 }