//public constructor for the class
 public clsCompanyCollection()
 {
     //var for the index
     Int32 Index = 0;
     //var to store the record count
     Int32 RecordCount = 0;
     //object for data connection
     clsDataConnection DB = new clsDataConnection();
     //execute the stored procedure
     DB.Execute("sproc_tblCompany_SelectAll");
     //get the count of records
     RecordCount = DB.Count;
     //while there are records to process
     while (Index < RecordCount)
     {
         //create a blank address
         clsCompany ACompany = new clsCompany();
         //read in the fields from the current record
         ACompany.CompanyCode = Convert.ToInt32(DB.DataTable.Rows[Index]["CompanyCode"]);
         ACompany.CompanyAddress = Convert.ToString(DB.DataTable.Rows[Index]["CompanyAddress"]);
         ACompany.CompanyEmailAddress = Convert.ToString(DB.DataTable.Rows[Index]["CompanyEmailAddress"]);
         ACompany.InvolvedClient = Convert.ToString(DB.DataTable.Rows[Index]["InvolvedClient"]);
         ACompany.InvolvedProject = Convert.ToString(DB.DataTable.Rows[Index]["InvolvedProject"]);
         ACompany.MobileNumber = Convert.ToString(DB.DataTable.Rows[Index]["MobileNumber"]);
         ACompany.PhoneNumber = Convert.ToString(DB.DataTable.Rows[Index]["PhoneNumber"]);
         //add the record to the private data member
         companyList.Add(ACompany);
         //point at the next record
         Index++;
     }
 }
示例#2
0
 public void CompanyAddressMid()
 {
     //create an instance of the class we want to create
     clsCompany ACompany = new clsCompany();
     //boolean variable to store the result of the validation
     Boolean OK = false;
     //create soem test data to pass out to the method
     string CompanyAddress = "aaa";//this should be ok
     string CompanyEmailAddress = "*****@*****.**";
     string InvolvedClient = "Callum Varle";
     string InvolvedProject = "TNovationProject";
     string MobileNumber = "654568";
     string PhoneNumber = "5457496";
     //invoke the method
     OK = ACompany.Valid(CompanyAddress, CompanyEmailAddress, InvolvedClient, InvolvedProject, MobileNumber, PhoneNumber);
     //test to see that the result is correct
     Assert.IsFalse(OK);
 }
示例#3
0
 public void TestPhoneNumberFound()
 {
     //create an instance of the class we want to create
     clsCompany ACompany = new clsCompany();
     //boolean variable to store the result of the search
     Boolean Found = false;
     //boolean variable to record if data is OK (assume that it is)
     Boolean OK = true;
     //create some test data to use with the method
     Int32 CompanyCode = 21;
     //invoke the method
     Found = ACompany.Find(CompanyCode);
     //check the company code
     if (ACompany.PhoneNumber != "3345354")
     {
         OK = false;
     }
     //test to see that the result is correct
     Assert.IsFalse(OK);
 }
示例#4
0
 public void PhoneNumberOK()
 {
     //create an instance of the class we want to create
     clsCompany APhone = new clsCompany();
     //create some test data to assign to the property
     string TestData = "3345354";
     //assign the data to the property
     APhone.PhoneNumber = TestData;
     //test to see the two values are the same
     Assert.AreEqual(APhone.PhoneNumber, TestData);
 }
示例#5
0
 public void TestCompanyEmailAddressFound()
 {
     //create an instance of the class we want to create
     clsCompany ACompany = new clsCompany();
     //boolean variable to store the result of the search
     Boolean Found = false;
     //boolean variable to record if data is OK (assume that it is)
     Boolean OK = true;
     //create some test data to use with the method
     Int32 CompanyCode = 21;
     //invoke the method
     Found = ACompany.Find(CompanyCode);
     //check the company code
     if (ACompany.CompanyEmailAddress != "*****@*****.**")
     {
         OK = false;
     }
     //test to see that the result is correct
     Assert.IsFalse(OK);
 }
示例#6
0
 public void InvolvedClientOK()
 {
     //create an instance of the class we want to create
     clsCompany AClient = new clsCompany();
     //create some test data to assign to the property
     string ATestData = "Freddy";
     //assign the data to the property
     AClient.InvolvedClient = ATestData;
     //test to see the two values are the same
     Assert.AreEqual(AClient.InvolvedClient, ATestData);
 }
示例#7
0
 public void InvolvedProjectOK()
 {
     //create an instance of the class we want to create
     clsCompany AProject = new clsCompany();
     //create some test data to assign to the property
     string TestData = "MyProject";
     //assign the data to the property
     AProject.InvolvedProject = TestData;
     //test to see the two values are the same
     Assert.AreEqual(AProject.InvolvedProject, TestData);
 }
示例#8
0
 public void FindMethodOK()
 {
     //create an instance of the class we want to create
     clsCompany ACompany = new clsCompany();
     //boolean variable to store the result of the validation
     Boolean Found = false;
     //create some test data to use with the method
     Int32 CompanyCode = 21;
     //invoke the method
     Found = ACompany.Find(CompanyCode);
     //test to see that the result is correct
     Assert.IsFalse(Found);
 }
示例#9
0
 public void InstanceOK()
 {
     //create an instance of the class we want to create
     clsCompany ACompany = new clsCompany();
     //test to see that it exists
     Assert.IsNotNull(ACompany);
 }
示例#10
0
 public void CompanyEmailAddressOK()
 {
     //create an instance of the class we want to create
     clsCompany AnEmail = new clsCompany();
     //create some test data to assign to the property
     string TestData = "*****@*****.**";
     //assign the data to the property
     AnEmail.CompanyEmailAddress = TestData;
     //test to see the two values are the same
     Assert.AreEqual(AnEmail.CompanyEmailAddress, TestData);
 }
示例#11
0
 public void CompanyEmailAddressMid()
 {
     //create an instance of the class we wnat to create
     clsCompany ACompany = new clsCompany();
     //boolean variable to store the result of the validation
     //Boolean OK = false;
     //create some test data to pass to the method
     //string CompanyAddress = "32a";
     //string CompanyEmailAddress = "*****@*****.**";
     //string InvolvedClient = "Thomas";
     //string InvolvedProject = "sdas";
     //string MobileNumber = "354351568";
     //string PhoneNumber = "5656561";
 }
示例#12
0
 public void CompanyEmailAddressExtremeMin()
 {
     //create an instance of the class we wnat to create
     clsCompany ACompany = new clsCompany();
     //boolean variable to store the result of the validation
     Boolean OK = false;
     //create some test data to pass to the method
     string CompanyAddress = "32a";
     string CompanyEmailAddress = "*****@*****.**";
     string InvolvedClient = "Thomas";
     string InvolvedProject = "sdas";
     string MobileNumber = "354351568";
     string PhoneNumber = "5656561";
     //create a variable to store the test company email address data
     //DateTime TestDate;
     // set the string to you email
     CompanyEmailAddress = "myemail";
     //change the date to variable to a string variable
     //TestDate = TestDate.AddYears(-100);
     //convert the date variable to a string variable
     //CompanyEmailAddress = TestDate.ToString();
     //invoke the method
     OK = ACompany.Valid(CompanyAddress, CompanyEmailAddress, InvolvedClient, InvolvedProject, MobileNumber, PhoneNumber);
     //test to see that the result is correct
     Assert.IsTrue(OK);
 }
示例#13
0
 public void CompanyCodeOK()
 {
     //create an instance of the class we want to create
     clsCompany ACompany = new clsCompany();
     //create some test data to assign to the property
     Int32 TestData = 21;
     //assign the data to the property
     ACompany.CompanyCode = TestData;
     //test to see the two values are the same
     Assert.AreEqual(ACompany.CompanyCode, TestData);
 }
示例#14
0
 public void CompanyAddressOK()
 {
     //create an instance of the class you want to create
     clsCompany ACompany = new clsCompany();
     //create to some test data to assign to the property
     string SomeCompany = "TNovation";
     //assign the data to the property
     ACompany.CompanyAddress = SomeCompany;
     //test to see the two values are same
     Assert.AreEqual(ACompany.CompanyAddress, SomeCompany);
 }