public void AddMethodOk() { //create an instance of the class we want to create clsPhoneCollection AllPhones = new clsPhoneCollection(); //create the item of test data clsPhone TestItem = new clsPhone(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.PhoneId = 1; TestItem.Make = "Apple"; TestItem.Model = "Iphone X"; TestItem.PhoneNo = "07749493975"; TestItem.Price = "500"; TestItem.ScreenSize = "7"; TestItem.CameraQuality = "HD"; //set ThisPhone to the test data AllPhones.ThisPhone = TestItem; //add the record PrimaryKey = AllPhones.Add(); //set the primary key of the test data TestItem.PhoneId = PrimaryKey; //find the record AllPhones.ThisPhone.Find(PrimaryKey); //test to see that the two values are the same Assert.AreEqual(AllPhones.ThisPhone, TestItem); }
public void DeleteMethodOk() { //create an instance of the class we want to create clsPhoneCollection AllPhones = new clsPhoneCollection(); //create the item of test data clsPhone TestItem = new clsPhone(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.PhoneId = 1; TestItem.Make = "Apple"; TestItem.Model = "Iphone X"; TestItem.PhoneNo = "07749493975"; TestItem.Price = "500"; TestItem.ScreenSize = "7"; TestItem.CameraQuality = "HD"; //set ThisPhone to the test data AllPhones.ThisPhone = TestItem; //add the record PrimaryKey = AllPhones.Add(); //set the primary key of the test data TestItem.PhoneId = PrimaryKey; //find the record AllPhones.ThisPhone.Find(PrimaryKey); //delete the record AllPhones.Delete(); //now find the record Boolean Found = AllPhones.ThisPhone.Find(PrimaryKey); //test to see that the record was not found Assert.IsFalse(Found); }
public void PhoneListOK() { //create an instance of the class we want to create clsPhoneCollection AllPhones = new clsPhoneCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <clsPhone> TestList = new List <clsPhone>(); //add an item to the list //create the item of test data clsPhone TestItem = new clsPhone(); //set its properties TestItem.Active = true; TestItem.PhoneID = 1; TestItem.Capacity = 128; TestItem.Price = 100; TestItem.Colour = "red"; TestItem.DateAdded = DateTime.Now.Date; TestItem.Description = "This is the latest phone."; TestItem.Make = "Apple"; TestItem.Model = "C3500"; TestItem.StockStatus = true; //add the item to the test list TestList.Add(TestItem); //assign the data to the property AllPhones.PhoneList = TestList; //test to see that the two values are the same Assert.AreEqual(AllPhones.PhoneList, TestList); }
public void ListAndCountOk() { //create an instance of the class we wish to create clsPhoneCollection AllPhones = new clsPhoneCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <clsPhone> TestList = new List <clsPhone>(); //add an item to the list //create the item test data clsPhone TestItem = new clsPhone(); //set its properties TestItem.PhoneId = 1; TestItem.Make = "Apple"; TestItem.Model = "Iphone X"; TestItem.PhoneNo = "07749493975"; TestItem.Price = "500"; TestItem.ScreenSize = "7"; TestItem.CameraQuality = "HD"; //add the item to the list TestList.Add(TestItem); //assign the data to the property AllPhones.PhoneList = TestList; //test to see that the two values are the same Assert.AreEqual(AllPhones.Count, TestList.Count); }
public void AddMethodOK() //Add Method { //create an instance of the class we want to create clsPhoneCollection AllPhones = new clsPhoneCollection(); //create the item of test data clsPhone TestItem = new clsPhone(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.Active = true; TestItem.PhoneID = 1; TestItem.Capacity = 128; TestItem.Price = 100; TestItem.Colour = "red"; TestItem.DateAdded = DateTime.Now.Date; TestItem.Description = "This is the latest phone."; TestItem.Make = "Apple"; TestItem.Model = "C3500"; TestItem.StockStatus = true; //set ThisPhone to the test data AllPhones.ThisPhone = TestItem; //add the record PrimaryKey = AllPhones.Add(); //set the primary key of the test data TestItem.PhoneID = PrimaryKey; //find the record AllPhones.ThisPhone.Find(PrimaryKey); //test to see that the two values are the same Assert.AreEqual(AllPhones.ThisPhone, TestItem); }
//this function displays the data for a phone on the web form void DisplayBrand(Int32 PhoneNo) { //create an instance of the phone class clsPhone MyPhoneBook = new clsPhone(); //find the record we want to display MyPhoneBook.Find(PhoneNo); //display the phone name txtPhoneName.Text = MyPhoneBook.PhoneName; //display the brand txtBrand.Text = MyPhoneBook.Brand; //display the screen size txtScreenSize.Text = MyPhoneBook.ScreenSize; //display the operating system txtOperatingSystem.Text = MyPhoneBook.OperatingSystem; //display the back camera txtBackCamera.Text = MyPhoneBook.BackCamera; //display the battery size txtBatterySize.Text = MyPhoneBook.BatterySize; //display the release data txtReleaseDate.Text = MyPhoneBook.ReleaseDate.ToString("dd/MM/yyyy"); //set the drop down list to display the Company No ddlCompany.SelectedValue = Convert.ToString(MyPhoneBook.CompanyNo); //display the active state chkDiscontinued.Checked = MyPhoneBook.Discontinued; }
public void InstanceOk() { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //test to see if that exists Assert.IsNotNull(APhone); }
public void ValidMethodOk() { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //string variable to store any error message String Error = ""; //invoke the method Error = APhone.Valid(PhoneMake, PhoneModel, PhoneNo, Price, ScreenSize, CameraQuality); //test to see that the result is ok Assert.AreEqual(Error, ""); }
public void PhoneIdPropertyOk() { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //create some test data to assign to the property Int32 TestData = 1; //assign the data to the property APhone.PhoneId = TestData; //test to see if the two values are the same Assert.AreEqual(APhone.PhoneId, TestData); }
public void ValidMethodOK() { //create an instance of the filtered data clsPhone APhone = new clsPhone(); //string variable to store any error message String Error = ""; //invoke the method Error = APhone.Valid(Capacity, Price, Colour, DateAdded, Description, Make, Model); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void PhonePricePropertyOk() { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //create some test data to assign to the property string TestData = "500"; //assign the data to the property APhone.Price = TestData; //test to see if the two values are the same Assert.AreEqual(APhone.Price, TestData); }
public void ColourPropertyOK() //Colour Property { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //create some test data to assign to the property String TestData = "red"; //assign the data to the property APhone.Colour = TestData; //test to see that the two values are the same Assert.AreEqual(APhone.Colour, TestData); }
public void PricePropertyOK() //Price Property { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //create some test data to assign to the property Int32 TestData = 100; //assign the data to the property APhone.Price = TestData; //test to see that the two values are the same Assert.AreEqual(APhone.Price, TestData); }
public void ActivePropertyOK() //Active Property { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //create some test data to assign to the property Boolean TestData = true; //assign the data to the property APhone.Active = TestData; //test to see that the two values are the same Assert.AreEqual(APhone.Active, TestData); }
public void DescriptionPropertyOK() //Description Property { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //create some test data to assign to the property String TestData = "This is the latest phone."; //assign the data to the property APhone.Description = TestData; //test to see that the two values are the same Assert.AreEqual(APhone.Description, TestData); }
public void DateAddedPropertyOK() //DateAdded Property { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //create some test data to assign to the property DateTime TestData = DateTime.Now.Date; //assign the data to the property APhone.DateAdded = TestData; //test to see that the two values are the same Assert.AreEqual(APhone.DateAdded, TestData); }
private void setTestdata() { objCustomer = new clsCustomer(); clsAddress objAddress = new clsAddress(); clsPhone objPhone = new clsPhone(); objCustomer.strCustomerName = "Shivprasad Koirala"; objAddress.strAddress1 = "Mumbai"; objAddress.strAddress2 = "Mulund"; objPhone.strPhoneNumber = "99881"; objAddress.objPhones.Add(objPhone); objCustomer.objAddresses.Add(objAddress); }
public void PhoneMakeMinLessOne() { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //string varaible to store any error message string Error = ""; //create some test data to pass to the method string PhoneMake = ""; //this should trigger an error //invoke the method Error = APhone.Valid(PhoneMake, PhoneModel, PhoneNo, Price, ScreenSize, CameraQuality); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void DateAddedInvalidData() { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //string variable to store any error message String Error = ""; //set the DateAdded to a non data value string DateAdded = "this is not a date!"; //invoke the method Error = APhone.Valid(Capacity, Price, Colour, DateAdded, Description, Make, Model); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void DescriptionMid() { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //string variable to store any error message String Error = ""; //this should pass string Description = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium."; //invoke the method Error = APhone.Valid(Capacity, Price, Colour, DateAdded, Description, Make, Model); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void FindMethodOk() { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //boolean variable to store the result of the validation Boolean Found = false; //create the test data to use with the method Int32 PhoneId = 1; //invoke the method Found = APhone.Find(PhoneId); //Test to see that the result is correct Assert.IsTrue(Found); }
public void PriceMid() { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //string variable to store any error message String Error = ""; // this should pass string Price = "500.00"; //invoke the method Error = APhone.Valid(Capacity, Price, Colour, DateAdded, Description, Make, Model); // test to see that the result is correct Assert.AreEqual(Error, ""); }
public void FindMethodOK() //Find Method { //create an instance of the filtered data clsPhone APhone = new clsPhone(); //boolean variable to store the result of the validation Boolean Found = false; //create some test data to use with the method Int32 PhoneID = 3; //invoke the method Found = APhone.Find(PhoneID); //test to see that the result is correct Assert.IsTrue(Found); }
public void ModelMaxPlusOne() { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //string variable to store any error message String Error = ""; //this should fail string Model = ""; Model = Model.PadRight(11, 'a'); //invoke the method Error = APhone.Valid(Capacity, Price, Colour, DateAdded, Description, Make, Model); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void PriceMinLessOne() { //create an instance of the filtered data clsPhone APhone = new clsPhone(); //string variable to store any error message String Error = ""; //create some test data to pass to the method string Price = "-0.01"; //this should fail //invoke the method Error = APhone.Valid(Capacity, Price, Colour, DateAdded, Description, Make, Model); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
private void btnAddPhone_Click(object sender, EventArgs e) { string lcReply = new InputBox(clsPhone.FACTORY_PROMPT).Answer; if (!string.IsNullOrEmpty(lcReply)) // not cancelled? { clsPhone lcPhone = clsPhone.NewPhone(lcReply[0]); FrmPhone.DispatchPhoneForm(lcPhone); if (lcPhone != null) // valid artwork created? { FrmMain.Instance.UpdateDisplay(); } } }
protected void Page_Load(object sender, EventArgs e) { //create a new instance of clsAddress clsPhone APhone = new clsPhone(); //get the data from the session object APhone = (clsPhone)Session["APhone"]; //display the phone id number for this entry Response.Write(APhone.Model); Response.Write(APhone.Make); Response.Write(APhone.Capacity); Response.Write(APhone.Price); Response.Write(APhone.Colour); Response.Write(APhone.DateAdded); Response.Write(APhone.StockStatus); }
public void PhoneCameraQualityMaxPlusOne() { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //boolean variable to store the result of the validation //Boolean OK = false; string Error = ""; //create some test data to pass to the method string CameraQuality = "aaaaaa"; //this should fail //invoke the method //OK = APhone.Valid(PhoneMake, PhoneModel, PhoneNo, Price, ScreenSize, CameraQuality); Error = APhone.Valid(PhoneMake, PhoneModel, PhoneNo, Price, ScreenSize, CameraQuality); //test to see that the result is correct //Assert.IsTrue(OK); Assert.AreNotEqual(Error, ""); }
public void DateAddedMin() { //create an instance of the class we want to create clsPhone APhone = new clsPhone(); //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 DateAdded = TestDate.ToString(); //invoke the method Error = APhone.Valid(Capacity, Price, Colour, DateAdded, Description, Make, Model); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void ThisPhonePropertyOk() { //create an instance of the class we want ot create clsPhoneCollection AllPhones = new clsPhoneCollection(); //create some test data to assign to the property clsPhone TestPhone = new clsPhone(); //set the properties to the test object TestPhone.PhoneId = 1; TestPhone.Make = "Apple"; TestPhone.Model = "IPhone X"; TestPhone.PhoneNo = "07749493975"; TestPhone.Price = "500"; TestPhone.ScreenSize = "7.2"; TestPhone.CameraQuality = "FHD"; //assign the data to the property AllPhones.ThisPhone = TestPhone; //test to see that the two values are the same Assert.AreEqual(AllPhones.ThisPhone, TestPhone); }