public void ListAndCountAddressOK() { //create an instance of the class we want to create clsAddressCollection AllAddresses = new clsAddressCollection(); //create test data to assign to the property //data needs to be a list of objects List <clsAddress> TestList = new List <clsAddress>(); //add item to the list //create the item of test data clsAddress TestItem = new clsAddress(); //set its properties TestItem.ChangeNo = 2; TestItem.HouseNo = "123b"; TestItem.Street = "London Road"; TestItem.Town = "Leicester"; TestItem.PostCode = "Le2 102"; TestItem.Email = "*****@*****.**"; //add the item to the list TestList.Add(TestItem); //assign the data to the property AllAddresses.AddressList = TestList; //test to see that the two values are the same Assert.AreEqual(AllAddresses.Count, TestList.Count); }
public void AddMethodAddressOK() { //create an instance of the class we want to create clsAddressCollection AllAddresses = new clsAddressCollection(); //create the item of test data clsAddress TestItem = new clsAddress(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.ChangeNo = 2; TestItem.HouseNo = "123b"; TestItem.Street = "London Road"; TestItem.Town = "Leicester"; TestItem.PostCode = "Le2 102"; TestItem.Email = "*****@*****.**"; //set ThisOrder to the test data AllAddresses.ThisAddress = TestItem; //add the record PrimaryKey = AllAddresses.AddAddress(); //set the primary key to the test data TestItem.ChangeNo = PrimaryKey; //find the record AllAddresses.ThisAddress.Find(PrimaryKey); //test to see that two values are the same Assert.AreEqual(AllAddresses.ThisAddress, TestItem); }
void AddAddress() { //create instance of the class clsAddressCollection NewAddress = new clsAddressCollection(); //validate the data on the web form String Error = NewAddress.ThisAddress.Valid(ddlCustomer.Text, txtHouseNo.Text, txtStreet.Text, txtTown.Text, txtPostcode.Text); if (Error == "") { //capture emailaddress NewAddress.ThisAddress.Email = ddlCustomer.Text; //capture delivery town NewAddress.ThisAddress.HouseNo = txtHouseNo.Text; //capture date added NewAddress.ThisAddress.Street = txtStreet.Text; //capture order value NewAddress.ThisAddress.Town = txtTown.Text; //capture order status NewAddress.ThisAddress.PostCode = txtPostcode.Text; //add the record NewAddress.AddAddress(); lblError.Text = "New address was added succesfully"; } else { //report error lblError.Text = "There were problems with the data entered: " + Error; } }
public void InstanceOK() { //create an instance of the class we want to create clsAddressCollection AllAddresses = new clsAddressCollection(); //test to see that it exists Assert.IsNotNull(AllAddresses); }
public void ThisAddressPropertyOK() { //create an instance of the class we want to create clsAddressCollection AllAddresses = new clsAddressCollection(); //create the item of test data clsAddress TestAddress = new clsAddress(); //set the properties of the test object TestAddress.ChangeNo = 2; TestAddress.HouseNo = "123b"; TestAddress.Street = "London Road"; TestAddress.Town = "Leicester"; TestAddress.PostCode = "Le2 102"; TestAddress.Email = "*****@*****.**"; //assign the data to the property AllAddresses.ThisAddress = TestAddress; //test to see that the two values are equal Assert.AreEqual(AllAddresses.ThisAddress, TestAddress); }
//function for adding void Add() { clsStockCollection StockBook = new clsAddressCollection(); //validate the data on the web form string Error = StockBook.ThisStock.valid(txtDateOfOrder.Text, txtShipmentDate.Text, txtSupplierID.Text, txtNumberOfOrder.Text, txtNumberShipped.Text, txtCost.Text, txtProductname.Text); if (Error == "") { StockBook.ThisStock.DateOfOrder = Convert.ToDateTime(txtDateOfOrder.Text); StockBook.ThisStock.ShipmentDate = Convert.ToDateTime(txtShipmentDate.Text); StockBook.ThisStock.SupplierID = Convert.ToInt32(txtSupplierID.Text); StockBook.ThisStock.NumberOfOrder = Convert.ToInt32(txtNumberOfOrder.Text); StockBook.ThisStock.NumberShipped = Convert.ToInt32(txtNumberShipped.Text); StockBook.ThisStock.Cost = txtCost.Text; StockBook.ThisStock.Productname = txtProductname.Text; //Add records StockBook.Add(); } else { //report an error lblError.Text = "there is problem with the data" + Error; } }
public void ProductListOK() { //create an instance of the class we want to create clsAddressCollection AllProducts = new clsAddressCollection(); //create some test data to assign to the property }