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); }
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 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); }