public void SupplierNameExtrmeMax() { //create an instance of the calss we want to create clsSupplier Supplier = new clsSupplier(); //string variable to store any error message String Error = ""; //create some test data to pass to the method string SupplierName = ""; SupplierName = SupplierName.PadRight(500, 'a');//this should be fail //invoke the method Error = Supplier.Valid(SupplierNo, SupplierName, Address, Postcode, Phone); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void ThisSupplierPropertyOK() { clsSupplierCollection AllSupplier = new clsSupplierCollection(); clsSupplier TestItem = new clsSupplier(); TestItem.SupplierID = 1; TestItem.CompanyName = "teesLTD"; TestItem.Product = "tShirts"; TestItem.PhoneNumber = "07456332127"; TestItem.EmailAddress = "*****@*****.**"; TestItem.Address = "101 Second Avenue"; TestItem.PostCode = "LE1 1ST"; AllSupplier.ThisSupplier = TestItem; Assert.AreEqual(AllSupplier.ThisSupplier, TestItem); }
public void Supplier_NameMaxLessOne() { //create an instance of the class we want to create clsSupplier ASupplier = new clsSupplier(); //string variable to store any error message String Error = ""; //this should pass string Supplier_Name = ""; Supplier_Name = Supplier_Name.PadRight(19, 'a'); //invoke the method Error = ASupplier.Valid(Supplier_Address, Supplier_Email, Supplier_Name, Supplier_Phone_No); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void ListAndCountOK() { clsSupplierCollection AllSupplier = new clsSupplierCollection(); List <clsSupplier> TestList = new List <clsSupplier>(); clsSupplier TestItem = new clsSupplier(); TestItem.SupplierID = 1; TestItem.CompanyName = "teesLTD"; TestItem.Product = "tShirts"; TestItem.PhoneNumber = "07456332127"; TestItem.EmailAddress = "*****@*****.**"; TestItem.Address = "101 Second Avenue"; TestItem.PostCode = "LE1 1ST"; TestList.Add(TestItem); AllSupplier.SupplierList = TestList; Assert.AreEqual(AllSupplier.Count, TestList.Count); }
protected void btnOK_Click(object sender, EventArgs e) { clsSupplier AnSupplier = new clsSupplier(); //capture the Suplier ID AnSupplier.Supplier_ID = Convert.ToInt32(txtSupplierID.Text); AnSupplier.SupplierName = txtSupplierName.Text; AnSupplier.SupplierAddress = txtSupplierAddress.Text; AnSupplier.SupplierPostCode = txtSupplierPostCode.Text; AnSupplier.Description = txtDescription.Text; AnSupplier.DeliveryDate = Convert.ToDateTime(txtDeliveryDate.Text); AnSupplier.StockAvailable = Convert.ToInt32(txtStockAvailable.Text); //store the ID in the session object Session["AnSupplier"] = AnSupplier; //redirect to the viewer page Response.Redirect("SupplierViewer.aspx"); }
protected void FindBtn_On_click(object sender, EventArgs e) { clssupplierConnection Supplier = new clsSupplier(); Boolean Found = false; int SupplierId = Convert.ToInt32(SupplierIdBox.Text); Found = Supplier.find(SupplierId); if (Found) { CompanyNameBox.Text = Supplier.Company_name; AddressBox.Text = Supplier.Address; PostalCode.Text = Supplier.Postalcode; Phone.Text = Supplier.phone; StockAvaliablity.Text = Supplier.stock_avaliablity; } }
public frmAddSupplier(frmSupplier frmSup, clsSupplier supplier) { InitializeComponent(); frmListSupplier = frmSup; if (supplier != null) { txtID.Text = Convert.ToString(supplier.ID); txtSupplierName.Text = supplier.Name; txtAddress.Text = supplier.Address; txtTown.Text = supplier.Town; txtPostCode.Text = supplier.Postcode; txtContactName.Text = supplier.ContactName; txtContactNo.Text = supplier.ContactNumber; btnAdd.Text = "Edit"; } }
public void AddMethodOK() { clsSupplierCollection AllSupplier = new clsSupplierCollection(); clsSupplier TestItem = new clsSupplier(); Int32 PrimaryKey = 0; TestItem.SupplierID = 1; TestItem.CompanyName = "teesLTD"; TestItem.Product = "tShirts"; TestItem.PhoneNumber = "07456332127"; TestItem.EmailAddress = "*****@*****.**"; TestItem.Address = "101 Second Avenue"; TestItem.PostCode = "LE1 1ST"; AllSupplier.ThisSupplier = TestItem; PrimaryKey = AllSupplier.Add(); TestItem.SupplierID = PrimaryKey; AllSupplier.ThisSupplier.Find(PrimaryKey); Assert.AreEqual(AllSupplier.ThisSupplier, TestItem); }
private void btnDelete_Click(object sender, EventArgs e) { if (lstSupplier.SelectedItems.Count > 0) { ListViewItem selectedItem = lstSupplier.SelectedItems[0]; clsSupplier supplier = (clsSupplier)selectedItem.Tag; // Display a message box asking users if they // want to delete the selected Supplier. if (MessageBox.Show("Are you sure to Delete this Supplier " + supplier.Name + "?", "Delete Supplier", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { // code for deleting the record goes here clsDBSupplier dbSupplier = new clsDBSupplier(); dbSupplier.DeleteSupplier(supplier.ID); loadSuppliers(); } } }
public void ThisSupplierPropertyOK() { clsSupplierCollection AllSupplier = new clsSupplierCollection(); clsSupplier TestSupplier = new clsSupplier(); TestSupplier.Address = "1b"; TestSupplier.City = "Birmingham"; TestSupplier.County = "eastmidlands"; TestSupplier.DateAdded = System.DateTime.Now.Date; TestSupplier.Mobile = "078"; TestSupplier.Name = "Mark"; TestSupplier.Postcode = "CV6"; TestSupplier.PositionInCompany = "1bbbbbbbbbbbbbbbbbbbbbb25"; TestSupplier.SupplierName = "Audi"; TestSupplier.Title = "Mr"; TestSupplier.WorkExt = "312"; TestSupplier.WorkNumber = "12134"; AllSupplier.ThisSupplier = TestSupplier; Assert.AreEqual(AllSupplier.ThisSupplier, TestSupplier); }
public void ThisSupplierPropertyOK() { //create an instance of the class we want to create clsSupplierCollection AllSuppliers = new clsSupplierCollection(); //create some test data to assign to the property clsSupplier TestSupplier = new clsSupplier(); //set the properties of the test object TestSupplier.Active = true; TestSupplier.Supplier_Address = "Some Supplier Address "; TestSupplier.CountyNo = 1; TestSupplier.Supplier_Email = "*****@*****.**"; TestSupplier.Supplier_Id = 001; TestSupplier.Supplier_Name = "Game.net"; TestSupplier.Supplier_Phone_No = "07331415589"; //assign the data to the property AllSuppliers.ThisSupplier = TestSupplier; //test to see that the two values are the same Assert.AreEqual(AllSuppliers.ThisSupplier, TestSupplier); }
protected void Button1_Click(object sender, EventArgs e) { clsSupplier supplier = new clsSupplier(); String SupplierId = TextBox2.Text; String CompanyName = TextBox3.Text; String StockAvaliablity = TextBox1.Text; Boolean active = Active.Checked; String Error = ""; Error = supplier.Valid(SupplierId, CompanyName, StockAvaliablity, active); if (Error == "") { supplier.active = active; supplier.SupplierId = SupplierId; supplier.Company_name = Company_Name; supplier.stock_avaliablity = StockAvaliablity; Session["supplier"] = supplier; clsSupplierCollection staffList = new clsSupplierCollection(); { } { } Response.Redirect("SupplierList.aspx"); } else { lblError.Text = Error; } }
private void btnAdd_Click(object sender, EventArgs e) { if (isValid()) { clsSupplier supplier = new clsSupplier(); supplier.Name = txtSupplierName.Text; supplier.Address = txtAddress.Text; supplier.Town = txtTown.Text; supplier.Postcode = txtPostCode.Text; supplier.ContactName = txtContactName.Text; supplier.ContactNumber = txtContactNo.Text; clsDBSupplier fbs = new clsDBSupplier(); Int32 added = 0; if (txtID.Text.Length > 0) { supplier.ID = Convert.ToInt32(txtID.Text); added = fbs.UpdateSupplier(supplier); } else { added = fbs.InsertSupplier(supplier); } if (added > 0) { frmListSupplier.loadSuppliers(); Close(); } else { txtErrorMessage.Text = "Could not added Supplier."; txtErrorMessage.Visible = true; } } else { txtErrorMessage.Text = "Specify valid values"; txtErrorMessage.Visible = true; } }
public void TestDeliveryDateFound() { //create an instance of the class we want to create clsSupplier AnSupplier = new clsSupplier(); //boolean variable to store the result of the validation Boolean Found = false; //boolean variable to record if data is OK (assume it is) Boolean OK = true; //create some test data Int32 Supplier_ID = 1; //invoke the method Found = AnSupplier.Find(Supplier_ID); //check the supplier date if (AnSupplier.DeliveryDate != Convert.ToDateTime("05/05/2020")) { OK = false; } //test to see that the result is correct Assert.IsTrue(OK); }
public void TestActiveFound() { //create an instance of the class we want clsSupplier ASupplier = new clsSupplier(); //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 Supplier_Id = 004; //invoke the method Found = ASupplier.Find(Supplier_Id); //check the supplier id ////////// if (ASupplier.Active != true) { OK = false; } //test to see that the result is correct Assert.IsTrue(OK); }
public void TestDescriptionFound() { //create an instance of the class we want to create clsSupplier AnSupplier = new clsSupplier(); //boolean variable to store the result of the validation Boolean Found = false; //boolean variable to record if data is OK (assume it is) Boolean OK = true; //create some test data Int32 Supplier_ID = 1; //invoke the method Found = AnSupplier.Find(Supplier_ID); //check the supplier description if (AnSupplier.Description != "We are the best") { OK = false; } //test to see that the result is correct Assert.IsTrue(OK); }
public void TestSupplierNameFound() { //create an instance of the calss we want to create clsSupplier Supplier = new clsSupplier(); //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 SupplierNo = 5; //invoke the method Found = Supplier.Find(SupplierNo); //check the supplier no if (Supplier.SupplierName != "eee") { OK = false; } //test to see that the result is correct Assert.IsTrue(OK); }
public void loadSuppliers(clsProductRecord productRecord) { clsDBSupplier dbSupplier = new clsDBSupplier(); List <clsSupplier> suppliers = dbSupplier.SupplierList(); Int32 Index = 0; cmbSupplierName.DisplayMember = "Name"; cmbSupplierName.ValueMember = "ID"; cmbSupplierName.Items.Clear(); while (Index < suppliers.Count) { clsSupplier supplier = suppliers[Index]; cmbSupplierName.Items.Add(supplier); //add the supplier to the list if (productRecord != null && (productRecord.SupplierId == supplier.ID)) { cmbSupplierName.SelectedItem = supplier; } Index++; //move the index to the next record } }
public void ListAndCountOK() { clsSupplierCollection AllSupplier = new clsSupplierCollection(); List <clsSupplier> TestList = new List <clsSupplier>(); clsSupplier TestItem = new clsSupplier(); TestItem.Address = "1b"; TestItem.City = "Birmingham"; TestItem.County = "eastmidlands"; TestItem.DateAdded = System.DateTime.Now.Date; TestItem.Mobile = "078"; TestItem.Name = "Mark"; TestItem.Postcode = "CV6"; TestItem.PositionInCompany = "1bbbbbbbbbbbbbbbbbbbbbb25"; TestItem.SupplierName = "Audi"; TestItem.Title = "Mr"; TestItem.WorkExt = "312"; TestItem.WorkNumber = "12134"; TestList.Add(TestItem); AllSupplier.SupplierList = TestList; Assert.AreEqual(AllSupplier.Count, TestList.Count); }
public void DeleteMethodOK() { clsSupplierCollection AllSupplier = new clsSupplierCollection(); clsSupplier TestItem = new clsSupplier(); Int32 PrimaryKey = 0; //data to delete TestItem.CompanyName = "teesLTD"; TestItem.Product = "tShirts"; TestItem.PhoneNumber = "07456332127"; TestItem.EmailAddress = "*****@*****.**"; TestItem.Address = "101 Second Avenue"; TestItem.PostCode = "LE1 1ST"; AllSupplier.ThisSupplier = TestItem; PrimaryKey = AllSupplier.Add(); TestItem.SupplierID = PrimaryKey; AllSupplier.ThisSupplier.Find(PrimaryKey); AllSupplier.Delete(); Boolean Found = AllSupplier.ThisSupplier.Find(PrimaryKey); Assert.IsFalse(Found); }
public void SupplierUpdateMethodOK() { clsSupplierCollection AllSuppliers = new clsSupplierCollection(); clsSupplier TestItem = new clsSupplier(); Int32 PrimaryKey = 0; TestItem.Address = "1b"; TestItem.City = "Birmingham"; TestItem.County = "eastmidlands"; TestItem.DateAdded = System.DateTime.Now.Date; TestItem.Mobile = "078"; TestItem.Name = "Mark"; TestItem.Postcode = "CV6"; TestItem.PositionInCompany = "1bbbbbbbbbbbbbbbbbbbbbb25"; TestItem.SupplierName = "Audi"; TestItem.Title = "Mr"; TestItem.WorkExt = "312"; TestItem.WorkNumber = "12134"; TestItem.SupplierEmail = "*****@*****.**"; AllSuppliers.ThisSupplier = TestItem; PrimaryKey = AllSuppliers.Add(); TestItem.SupplierID = PrimaryKey; TestItem.Address = "2b"; TestItem.City = "Coventry"; TestItem.County = "westmidlands"; TestItem.DateAdded = System.DateTime.Now.Date; TestItem.Mobile = "079"; TestItem.Name = "john"; TestItem.Postcode = "CV8"; TestItem.PositionInCompany = "1cccccccc"; TestItem.SupplierName = "bmw"; TestItem.Title = "Mrs"; TestItem.WorkExt = "412"; TestItem.WorkNumber = "1214"; TestItem.SupplierEmail = "*****@*****.**"; AllSuppliers.Update(); AllSuppliers.ThisSupplier.Find(PrimaryKey); Assert.AreEqual(AllSuppliers.ThisSupplier, TestItem); }
public void TestProperties() { clsSupplier cs = new clsSupplier(); Int32 id = 1; cs.ID = id; Assert.AreEqual(cs.ID, id); string name = "BT"; cs.Name = name; Assert.AreEqual(cs.Name, name); string address = "28 Leire Street"; cs.Address = address; Assert.AreEqual(cs.Address, address); string town = "Leicester"; cs.Town = town; Assert.AreEqual(cs.Town, town); string postcode = "LE4 6NT"; cs.Postcode = postcode; Assert.AreEqual(cs.Postcode, postcode); string contactname = "Tom"; cs.ContactName = contactname; Assert.AreEqual(cs.ContactName, contactname); string contactnumber = "07912895643"; cs.ContactNumber = contactnumber; Assert.AreEqual(cs.ContactNumber, contactnumber); }
public void InstanceOk() { clsSupplier Agame = new clsSupplier(); Assert.IsNotNull(Agame); }
public void TestMethod1() { clsSupplier AnSupplierName = new clsSupplier(); Assert.IsNotNull(AnSupplierName); }
public void InstanceOK() { clsSupplier ASupplier = new clsSupplier(); Assert.IsNotNull(ASupplier); }
public void InstanceOK() { clsSupplier cs = new clsSupplier(); Assert.IsNotNull(cs); }