public void AddMethodOK() { //CREATE AN INSTANCE OF THE CLASS WE WANT TO CREATE clsContractCollection AllContracts = new clsContractCollection(); //create an instance of test data clsContract TestItem = new clsContract(); //var to store primary key Int32 PrimaryKey = 0; //set the properties TestItem.ContractNo = 21; TestItem.CustomerNo = 1; TestItem.PhoneID = 1; TestItem.ContractType = "36"; TestItem.StartDateOfContract = DateTime.Now.Date; TestItem.EndDateOfContract = DateTime.Now.Date; //Set thisContract to test the data AllContracts.ThisContract = TestItem; //add the record PrimaryKey = AllContracts.Add(); //find the record AllContracts.ThisContract.Find(PrimaryKey); //test to see that it exists Assert.AreEqual(AllContracts.ThisContract, TestItem); }
public void DeleteMethodOK() { //create an instance of the class we want to create clsContractCollection AllContract = new clsContractCollection(); //create an instance of test data clsContract TestItem = new clsContract(); //var to store primary key Int32 PrimaryKey = 0; //set the properties //TestItem.CustomerNo = 3; TestItem.ContractNo = 21; TestItem.CustomerNo = 1; TestItem.PhoneID = 1; TestItem.ContractType = "36"; TestItem.StartDateOfContract = DateTime.Now.Date; TestItem.EndDateOfContract = DateTime.Now.Date; //set ThisCustomer to validate test data AllContract.ThisContract = TestItem; //add the record PrimaryKey = AllContract.Add(); //set primary key of test data TestItem.CustomerNo = PrimaryKey; //find the record AllContract.ThisContract.Find(PrimaryKey); //delete the record AllContract.Delete(); //now find the record Boolean Found = AllContract.ThisContract.Find(PrimaryKey); //test to see that it exists Assert.IsFalse(Found); }
public void ListAndCountOK() { //create an instance of the class we want to create clsContractCollection AllContracts = new clsContractCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <clsContract> TestList = new List <clsContract>(); //add an item to the list //create the item of test data clsContract TestItem = new clsContract(); //set its properties TestItem.ContractNo = 21; TestItem.CustomerNo = 1; TestItem.PhoneID = 1; TestItem.ContractType = "36"; TestItem.StartDateOfContract = DateTime.Now.Date; TestItem.EndDateOfContract = DateTime.Now.Date; //add the item to the test list TestList.Add(TestItem); //assign the data to the property AllContracts.ContractList = TestList; //test to see that the two values are the same Assert.AreEqual(AllContracts.ContractList, TestList); }
public void InstanceOK() { //create an instance of the class we want to create clsContract AnContract = new clsContract(); //test to see that it exists Assert.IsNotNull(AnContract); }
public void ContractTypeOK() { //create an instance of the new class we want to create clsContract AnContract = new clsContract(); //create some test data to assign to the property string TestData = "36"; //assign the data to the property AnContract.ContractType = TestData; //test to see that the two values are the same Assert.AreEqual(AnContract.ContractType, TestData); }
public void CustomerNoOK() { //create an instance of the new class we want to create clsContract AnContract = new clsContract(); //create some test data to assign to the property Int32 TestData = 33; //assign the data to the property AnContract.CustomerNo = TestData; //test to see that the two values are the same Assert.AreEqual(AnContract.CustomerNo, TestData); }
public void EndDateOfContractPropertyOK() { //create an instance of the class we want to create clsContract AnContract = new clsContract(); //create some test data to assign to the property DateTime TestData = DateTime.Now.Date; //assign the data to the property AnContract.EndDateOfContract = TestData; //test to see that the two values are the same Assert.AreEqual(AnContract.EndDateOfContract, TestData); }
public void validmethodOK() { //create an instance of the new class we want to create clsContract AnContract = new clsContract(); //create a string variable to store the results of the method string Error = ""; //invoke the method Error = AnContract.Valid(ContractNo, CustomerNo, PhoneID, ContractType, StartDateOfContract, EndDateOfContract); //test to see that the result is ok i.e there was no error message returned Assert.AreEqual(Error, ""); }
public void FilterbyContractTypeMethodOK() { clsContract TestItem = new clsContract(); //create an instance of the class we want to create clsContractCollection AllContract = new clsContractCollection(); //create an instance of the filtered data clsContractCollection FilteredContracts = new clsContractCollection(); //apply a blank string (should return all records) FilteredContracts.FilterbyContractType(""); //test to see the two values are the same Assert.AreEqual(AllContract.Count, FilteredContracts.Count); }
public void FindMethodOK() { //create an instance of the new class we want to create clsContract AnContract = new clsContract(); //boolen variable to store the result of the validation Boolean Found = false; //create some test data to use with the method Int32 ContractNo = 1; //invoke the method Found = AnContract.Find(ContractNo); //test to see that the result is correct Assert.IsTrue(Found); }
public void ContractTypeMid() { //create an instance of the class we want to create clsContract AContract = new clsContract(); //sting variable to store an error message string Error = ""; //create some test to data to pass to the method string ContractType = "5"; //this should trigger an error //invoke the method Error = AContract.Valid(ContractNo, CustomerNo, PhoneID, ContractType, StartDateOfContract, EndDateOfContract); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void ThisContractPropertyOK() { //create an instance of the class we want to create clsContractCollection AllContracts = new clsContractCollection(); //create some test data to assign to the property clsContract TestContract = new clsContract(); //set the properties of the test object TestContract.ContractNo = 21; TestContract.CustomerNo = 1; TestContract.PhoneID = 1; TestContract.ContractType = "36"; TestContract.StartDateOfContract = DateTime.Now.Date; TestContract.EndDateOfContract = DateTime.Now.Date; //assign the data to the property AllContracts.ThisContract = TestContract; //test to see that the two values are the same Assert.AreEqual(AllContracts.ThisContract, TestContract); }
//[TestMethod] //public void StartDateOfContractMaxMinusOne() //{ // //create an instance of the class we want to create // clsContract AContract = new clsContract(); // //string variable to store the results of the validation // String OK = ""; // //set the date totaldays date // DateTime SomeDate; // SomeDate = DateTime.Now.Date; // //change to date the whatever date is 100 years in the future // SomeDate = SomeDate.AddDays(1); // //Convert data to a string variable // string DateAdded = SomeDate.ToString(); // //invoke the method // OK = AContract.Valid(ContractNo, CustomerNo, PhoneID, ContractType, StartDateOfContract, EndDateOfContract); // //test to see that the result is correct // Assert.AreNotEqual(OK, ""); //} public void StartDateOfContractMax() { //create an instance of the class we want to create clsContract AContract = new clsContract(); //string variable to store the results of the validation String OK = ""; //set the date totaldays date DateTime SomeDate; //set test date as todays daye SomeDate = DateTime.Now.Date; //Convert data to a string variable string DateAdded = SomeDate.ToString(); //invoke the method OK = AContract.Valid(ContractNo, CustomerNo, PhoneID, ContractType, StartDateOfContract, EndDateOfContract); //test to see that the result is correct Assert.AreEqual(OK, ""); }
public void ContractListOK() { //create an instance of the class we want to create clsContractCollection AllContracts = new clsContractCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <clsContract> TestList = new List <clsContract>(); //add an item to the list //create the item of test data clsContract TestItem = new clsContract(); //set its properties TestItem.ContractNo = 21; TestItem.CustomerNo = 1; TestItem.PhoneID = 1; TestItem.ContractType = "36"; TestItem.StartDateOfContract = DateTime.Now.Date; TestItem.EndDateOfContract = DateTime.Now.Date; }
public void StartDateOfContractMinLessOne() { //create an instance of the class we want to create clsContract AContract = new clsContract(); //string variable to store the results of the validation String OK = ""; //create a variable to store the test date data DateTime SomeDate; //set the date totaldays date SomeDate = DateTime.Now.Date; //change the date to whatever the date is less 1 today SomeDate = SomeDate.AddDays(-1); //convert the date variable to a string variable string StartDateOfContract = SomeDate.ToString(); //invoke the method OK = AContract.Valid(ContractNo, CustomerNo, PhoneID, ContractType, StartDateOfContract, EndDateOfContract); //test to see that the result is correct Assert.AreNotEqual(OK, ""); }
public void TestEndDateOfContractFound() { //create an instance of the new class we want to create clsContract AnContract = new clsContract(); //boolean variable to store the result of the search Boolean Found = false; //boolean variable to record if data is ok (assume it is) Boolean OK = true; //create some test data to use with the method Int32 ContractNo = 21; //invoke the method Found = AnContract.Find(ContractNo); //check the contract no if (AnContract.EndDateOfContract != Convert.ToDateTime("01/02/2011")) { OK = false; } //test to see that the result is correct Assert.IsTrue(OK); }
public void TestContractTypeFound() { //create an instance of the new class we want to create clsContract AnContract = new clsContract(); //boolean variable to store the result of the search Boolean Found = false; //boolean variable to record if data is ok (assume it is) Boolean OK = true; //create some test data to use with the method Int32 ContractNo = 21; //invoke the method Found = AnContract.Find(ContractNo); //CHECK THE CONTRACT NO if (AnContract.ContractType != "36") { OK = false; } //test to see that the result is correct Assert.IsTrue(OK); }
public void UpdateMethodOK() { //create an instance of the class we want to create clsContractCollection AllContract = new clsContractCollection(); //create an instance of test data clsContract TestItem = new clsContract(); //var to store primary key Int32 PrimaryKey = 0; //TestItem.ContractNo = 3; //TestItem.ContractNo = 1; TestItem.ContractNo = 21; TestItem.CustomerNo = 1; TestItem.PhoneID = 1; TestItem.ContractType = "36"; TestItem.StartDateOfContract = DateTime.Now.Date; TestItem.EndDateOfContract = DateTime.Now.Date; //set ThisCustomer to validate test data AllContract.ThisContract = TestItem; //add the record PrimaryKey = AllContract.Add(); //set primary key of test data TestItem.ContractNo = PrimaryKey; //modify the record //TestItem.ContractNo = 1; TestItem.ContractNo = 21; TestItem.CustomerNo = 1; TestItem.PhoneID = 1; TestItem.ContractType = "36"; TestItem.StartDateOfContract = DateTime.Now.Date; TestItem.EndDateOfContract = DateTime.Now.Date; //set the record based on the new record AllContract.ThisContract = TestItem; //update the record AllContract.Update(); //find the record AllContract.ThisContract.Find(PrimaryKey); //test to see that it exists Assert.AreEqual(AllContract.ThisContract, TestItem); }
public void EndDateOfContractExtremeMin() { //create an instance of the class we want to create clsContract AContract = new clsContract(); //string variable to store the results of the validation String OK = ""; //set the date totaldays date DateTime SomeDate; //set test date as todays date SomeDate = DateTime.Now.Date; //change to date the whatever date is 100 years in the future SomeDate = SomeDate.AddDays(-100); //Convert data to a string variable string EndDateOfContract = SomeDate.ToString(); EndDateOfContract = Convert.ToString(SomeDate); //invoke the method OK = AContract.Valid(ContractNo, CustomerNo, PhoneID, ContractType, StartDateOfContract, EndDateOfContract); //test to see that the result is correct Assert.AreNotEqual(OK, ""); }