public void AddMethodOK() { //create an instance of the class we want to create clsCompanyCollection AllCompanies = new clsCompanyCollection(); //create an item of test data clsCompany TestItem = new clsCompany(); //var to store the primary key Int32 PrimaryKey = 0; //set it's properties TestItem.CompanyID = 1; TestItem.CompanyName = "some company"; TestItem.Address = "some address"; TestItem.PostCode = "le2 7pt"; TestItem.TeleNum = "12345678910"; TestItem.Email = "someEmail@com"; TestItem.Description = "this is an example"; //set ThisCompany to the test data AllCompanies.ThisCompany = TestItem; //add the record PrimaryKey = AllCompanies.Add(); //set the primary key of the test data TestItem.CompanyID = PrimaryKey; //find the record AllCompanies.ThisCompany.Find(PrimaryKey); //test to see that the two values are the same Assert.AreEqual(AllCompanies.ThisCompany, TestItem); }
Int32 DisplayCompanies() { //create an instance of the company class clsCompanyCollection Companies = new clsCompanyCollection(); //var to store the company no primary string CompanyNo; //var to store the company name String Company; //var to store the index for the loop Int32 Index = 0; //while the infex is less that the number of records to process while (Index < Companies.Count) { //get the company number from the database CompanyNo = Convert.ToString(Companies.AllCompanies[Index].CompanyNo); //get the company name from the databse Company = Convert.ToString(Companies.AllCompanies[Index].Company); //set up the new row to be added to the list ListItem NewCompany = new ListItem(Company, CompanyNo); //add the new row to the list ddlCompany.Items.Add(NewCompany); //increment the index Index++; } //return the number of records founds return(Companies.Count); }
public void ListAndCountOK() { //create an instance of the class we want to create clsCompanyCollection AllCompanies = new clsCompanyCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <clsCompany> TestList = new List <clsCompany>(); //add an item to the list //create the item of test data clsCompany TestItem = new clsCompany(); //set it's properties TestItem.CompanyID = 1; TestItem.CompanyName = "Some Company"; TestItem.Address = "Some Address"; TestItem.PostCode = "LE2 7PT"; TestItem.TeleNum = "1234567890"; TestItem.Email = "*****@*****.**"; TestItem.Description = "This is an example"; //add the item to the list TestList.Add(TestItem); //assign the data to the property AllCompanies.CompanyList = TestList; //test to see that it exists Assert.AreEqual(AllCompanies.Count, TestList.Count); }
public void CountPropertyOK() { clsCompanyCollection AllCompanies = new clsCompanyCollection(); Int32 SomeCount = 33; AllCompanies.Count = SomeCount; Assert.AreEqual(AllCompanies.Count, SomeCount); }
public void InstanceOK() { //create an instance of the class we want to create clsCompanyCollection AllCompanies = new clsCompanyCollection(); //test to see that it exists Assert.IsNotNull(AllCompanies); }
public void ThisCompanyPropertyOK() { clsCompanyCollection AllCompanies = new clsCompanyCollection(); clsCompany TestCompany = new clsCompany(); TestCompany.Active = true; TestCompany.CompanyName = "DMU"; TestCompany.CompanyAddress = "85 street"; TestCompany.Email = "*****@*****.**"; TestCompany.ContactNo = "33"; AllCompanies.ThisCompany = TestCompany; Assert.AreEqual(AllCompanies.ThisCompany, TestCompany); }
public void ListAndCountOK() { clsCompanyCollection AllCompanies = new clsCompanyCollection(); List <clsCompany> TestList = new List <clsCompany>(); clsCompany TestItem = new clsCompany(); TestItem.Active = true; TestItem.CompanyName = "DMU"; TestItem.CompanyAddress = "85 street"; TestItem.Email = "*****@*****.**"; TestItem.ContactNo = "33"; TestList.Add(TestItem); AllCompanies.CompanyList = TestList; Assert.AreEqual(AllCompanies.Count, TestList.Count); }
Int32 DisplayCompanies() { //create an instance of the company collection clsCompanyCollection MyCompany = new clsCompanyCollection(); //find all the companies MyCompany.FindAllCompanies(); //set the data source of the list box listCompanies.DataSource = MyCompany.ListCompany; //set the text to be displayed listCompanies.DisplayMember = "CompanyName"; //set the primary key value listCompanies.ValueMember = "CompanyID"; //return the count of records in the list return(MyCompany.Count); }
public void AddMethodOK() { clsCompanyCollection AllCompanies = new clsCompanyCollection(); clsCompany TestItem = new clsCompany(); string PrimaryKey = "0744121212"; TestItem.Active = true; TestItem.CompanyName = "DMU"; TestItem.CompanyAddress = "85 street"; TestItem.Email = "*****@*****.**"; TestItem.ContactNo = "33"; AllCompanies.ThisCompany = TestItem; PrimaryKey = AllCompanies.Add(); TestItem.ContactNo = PrimaryKey; //AllCompanies.ThisCompany.//Find(PrimaryKey); //Assert.AreEqual(AllCompanies.ThisCompany, TestItem); }
public void DeleteMethodOK() { clsCompanyCollection AllCompanies = new clsCompanyCollection(); clsCompany TestItem = new clsCompany(); string PrimaryKey = "0744121212"; TestItem.Active = true; TestItem.CompanyName = "DMU"; TestItem.CompanyAddress = "85 street"; TestItem.Email = "*****@*****.**"; TestItem.ContactNo = "33"; AllCompanies.ThisCompany = TestItem; PrimaryKey = AllCompanies.Add(); TestItem.ContactNo = PrimaryKey; //AllCompanies.ThisCompany.Find(PrimaryKey); AllCompanies.Delete(); //Boolean Found = AllCompanies.ThisCompany.Find(PrimaryKey); //Assert.IsFalse(Found); }
public void ThisCompanyPropertyOK() { //create an instance of the class we want to create clsCompanyCollection AllCompanies = new clsCompanyCollection(); //create some test data to assign to the property clsCompany TestCompany = new clsCompany(); //set it's properties of the test object TestCompany.CompanyID = 1; TestCompany.CompanyName = "Some Company"; TestCompany.Address = "Some Address"; TestCompany.PostCode = "LE2 7PT"; TestCompany.TeleNum = "1234567890"; TestCompany.Email = "*****@*****.**"; TestCompany.Description = "This is an example"; //assign the data to the property AllCompanies.ThisCompany = TestCompany; //test to see that it exists Assert.AreEqual(AllCompanies.ThisCompany, TestCompany); }
public void UpdateMethodOK() { //create an instance of the class we want to create clsCompanyCollection AllCompanies = new clsCompanyCollection(); //create an item of test data clsCompany TestItem = new clsCompany(); //var to store the primary key Int32 PrimaryKey = 0; //set it's properties TestItem.CompanyID = 1; TestItem.CompanyName = "some company"; TestItem.Address = "some address"; TestItem.PostCode = "le2 7pt"; TestItem.TeleNum = "12345678910"; TestItem.Email = "someEmail@com"; TestItem.Description = "this is an example"; //set ThisCompany to the test data AllCompanies.ThisCompany = TestItem; //add the record PrimaryKey = AllCompanies.Add(); //set the primary key of the test data TestItem.CompanyID = PrimaryKey; //modify the test data TestItem.CompanyID = 2; TestItem.CompanyName = "another company"; TestItem.Address = "another address"; TestItem.PostCode = "sy3 4et"; TestItem.TeleNum = "0987654321"; TestItem.Email = "someEmail@com"; TestItem.Description = "this is another example"; //set the record based on the new test data AllCompanies.ThisCompany = TestItem; //update the record AllCompanies.Update(); //find the record AllCompanies.ThisCompany.Find(PrimaryKey); //test to see that the record was not found Assert.AreEqual(AllCompanies.ThisCompany, TestItem); }
public void InstanceOK() { clsCompanyCollection AllCompanies = new clsCompanyCollection(); Assert.IsNotNull(AllCompanies); }
public void TwoRecordsPresent() { clsCompanyCollection AllCompanies = new clsCompanyCollection(); Assert.AreEqual(AllCompanies.Count, 2); }