Example #1
0
        public void FindAllCompanies()
        {
            //re-set the database connection
            MyDB = new clsDataConnection();
            //variable to store the index
            Int32 Index = 0;
            //variable to store the company number of the count record
            Int32 CompanyID;
            //variable to flag that the company was found
            Boolean CompanyFound;

            //execute the stored procedure
            MyDB.Execute("Sproc_tblCompany_SelectAll");
            //get the count of records
            RecordCount = MyDB.Count;

            //while there are stil records to count
            while (Index < MyDB.Count)
            {
                //create an instance of the company class
                clsCompany NewCompany = new clsCompany();
                //get the company number from the database
                CompanyID = Convert.ToInt32(MyDB.DataTable.Rows[Index]["CompanyID"]);
                //find the company by invoking the find method
                CompanyFound = NewCompany.Find(CompanyID);

                if (CompanyFound == true)
                {
                    //add the user to the list
                    CompanyList.Add(NewCompany);
                }
                //increment the index
                Index++;
            }
        }
Example #2
0
        public void FindMethodOK()
        {
            clsCompany ACompany  = new clsCompany();
            Boolean    Found     = false;
            string     ContactNo = "0744121212";

            Found = ACompany.Find();
            Assert.IsTrue(Found);
        }
Example #3
0
        public void TestAddressFound()
        {
            clsCompany ACompany = new clsCompany();
            Boolean    Found    = false;
            Boolean    OK       = true;

            Found = ACompany.Find();
            if (ACompany.Address == "85 Street")
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
Example #4
0
        public void TestEmailFound()
        {
            clsCompany ACompany = new clsCompany();
            Boolean    Found    = false;
            Boolean    OK       = true;

            Found = ACompany.Find();
            if (ACompany.Email == "*****@*****.**")
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
Example #5
0
        public void TestCompanyNameFound()
        {
            clsCompany ACompany = new clsCompany();
            Boolean    Found    = false;
            Boolean    OK       = true;

            Found = ACompany.Find();
            if (ACompany.ContactNo == "0744121212")
            {
                OK = true;
            }
            Assert.IsTrue(OK);
        }
Example #6
0
        public void ValidMethodOK()
        {
            clsCompany ACompany = new clsCompany();
            Boolean    OK       = false;
            Boolean    Found    = false;

            Found = ACompany.Find();

            string CompanyName = "DMU";
            string Address     = "85 Street";
            string Email       = "*****@*****.**";
            string ContactNo   = "0744121212";

            OK = ACompany.Valid(CompanyName, Address, Email, ContactNo);

            Assert.IsTrue(OK);
        }