public void VaidMethodOK() { //create an instance of the class we want to create clsManufacturer AnManufacturer = new clsManufacturer(); //string variable to store any error message string Error = ""; //invoke the method Error = AnManufacturer.Valid(CarModel, ChairMan, Email, YearMade); // test to see that the result is correct Assert.AreEqual(Error, ""); }
public void ValidMethodOk() { // Create instance of the class clsManufacturer AnManufacturer = new clsManufacturer(); //String variable to store any error message String Error = ""; //Invoke the method Error = AnManufacturer.Valid(ManufacturerNo, ManufacturerName, Address, PostCode, Town, TelephoneNo, Email, DateAdded); //Test to see that the result is correct Assert.AreEqual(Error, ""); }
public void ValidMethod3Ok() { // Create instance of the class clsManufacturer AnManufacturer = new clsManufacturer(); //String variable to store any error message String Error = ""; //Create some test data to test the method string SomeManufacturer = "Apple"; //Invoke the method Error = AnManufacturer.Valid(SomeManufacturer); //Test to see that the result is Ok Assert.AreEqual(Error, ""); }
public void DateAddedInvalidData() { // Create instance of the class clsManufacturer AnManufacturer = new clsManufacturer(); //String variable to store any error message String Error = ""; //Set the DateAdded to a non date value string DateAdded = "this is not a date!"; //Invoke the method Error = AnManufacturer.Valid(ManufacturerNo, ManufacturerName, Address, PostCode, Town, TelephoneNo, Email, DateAdded); //Test to see that the results is correct Assert.AreNotEqual(Error, ""); }
public void YearMadeInvalidData() { //create an instance of the class we want to create clsManufacturer AnManufacturer = new clsManufacturer(); //string variable to store any error message String Error = ""; //set the yearmade to a non date value string YearMade = "This is not a date"; //invoke the methods Error = AnManufacturer.Valid(CarModel, ChairMan, Email, YearMade); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
protected void btnOK_Click(object sender, EventArgs e) { //create an instance of the address page class clsManufacturer ThisManufacturer = new clsManufacturer(); //var to store any error message string ErrorMessage; //test the data on teh web form ErrorMessage = ThisManufacturer.Valid( txtManufacturerName.Text, txtManufacturerTelephone.Text, txtManufacturerEmail.Text); //if there is no error message if (ErrorMessage == "") { //create a new instance of the address book class clsManufacturerCollection Manufacturer = new clsManufacturerCollection(); //do something with the data - insert or update // //if the Laptop Number is -1 if (ManufacturerNo == -1) { //copy the data from the interface to the object; Manufacturer.ThisManufacturer.ManufacturerName = txtManufacturerName.Text; Manufacturer.ThisManufacturer.ManufacturerTelephone = txtManufacturerTelephone.Text; Manufacturer.ThisManufacturer.ManufacturerEmail = txtManufacturerEmail.Text; //add the new record Manufacturer.Add(); } else { //this is an existing record //copy the data from the interface to the object Manufacturer.ThisManufacturer.ManufacturerName = txtManufacturerName.Text; Manufacturer.ThisManufacturer.ManufacturerTelephone = txtManufacturerTelephone.Text; Manufacturer.ThisManufacturer.ManufacturerEmail = txtManufacturerEmail.Text; //update the existing record Manufacturer.Update(); } //redircet bact to the main page Response.Redirect("ManufacturerManagement.aspx"); } else { //display the error message lblError.Text = ErrorMessage; } }
public void EmailMaxLessOne() { // Create instance of the class clsManufacturer AnManufacturer = new clsManufacturer(); //String variable to store any error message String Error = ""; //This should pass string Email = ""; Email = Email.PadRight(59, 'c'); //Invoke the method Error = AnManufacturer.Valid(ManufacturerNo, ManufacturerName, Address, PostCode, Town, TelephoneNo, Email, DateAdded); //Test to see that the results is correct Assert.AreEqual(Error, ""); }
public void EmailMax() { //create an instance of the class we want to create clsManufacturer AnManufacturer = new clsManufacturer(); //string variable to store any error message string Error = ""; //this should pass string Email = ""; // this should be ok Email = Email.PadRight(50, 'a'); //invoke the method Error = AnManufacturer.Valid(CarModel, ChairMan, Email, YearMade); // test to see that the result is correct Assert.AreEqual(Error, ""); }
public void ChairManMaxPlusOne() { //create an instance of the class we want to create clsManufacturer AnManufacturer = new clsManufacturer(); //string variable to store any error message string Error = ""; //this should fail string ChairMan = ""; ChairMan = ChairMan.PadRight(36, 'a'); //invoke the method Error = AnManufacturer.Valid(CarModel, ChairMan, Email, YearMade); // test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void DateAddedMin() { // Create instance of the class clsManufacturer AnManufacturer = new clsManufacturer(); //String variable to store any error message String Error = ""; //Create a variable to store the test date data DateTime TestDate; //Set the date todays date TestDate = DateTime.Now.Date; //Convert the date variable to a string variable string DateAdded = TestDate.ToString(); //Invoke the method Error = AnManufacturer.Valid(ManufacturerNo, ManufacturerName, Address, PostCode, Town, TelephoneNo, Email, DateAdded); //Test to see that the results is correct Assert.AreEqual(Error, ""); }
public void YearMadeMin() { //create an instance of the class we want to create clsManufacturer AnManufacturer = new clsManufacturer(); //string variable to store any error message String Error = ""; //create a variable to store the test date data DateTime TestDate; //set the date totodays date TestDate = DateTime.Now.Date; //convert the date variable to a string variable string YearMade = TestDate.ToString(); //invoke the method Error = AnManufacturer.Valid(CarModel, ChairMan, Email, YearMade); //test to see that the result is correct Assert.AreEqual(Error, ""); }