public void UpdateMethodOK() { clsSupplyCollection collection = new clsSupplyCollection(); clsSupply TestClass = new clsSupply(); TestClass.InStock = true; TestClass.Name = "cos tamno"; TestClass.Price = 43; TestClass.Quantity = 22; TestClass.DeliveryDate = DateTime.Now.Date; collection.ThisSupply = TestClass; Int32 PrimaryKey = collection.Add(); PrimaryKey = TestClass.ProductID; TestClass.InStock = false; TestClass.Name = "different input"; TestClass.Price = 8; TestClass.Quantity = 2342; TestClass.DeliveryDate = DateTime.Now.Date; collection.ThisSupply = TestClass; collection.Update(); collection.ThisSupply.Find(PrimaryKey); Assert.AreEqual(collection.ThisSupply, TestClass); }
public void TestCountOK() { clsSupplyCollection allSupply = new clsSupplyCollection(); Int32 Somecount = 0; allSupply.Count = Somecount; Assert.AreEqual(allSupply.Count, Somecount); }
public void ReportByNameNoneFound() { clsSupplyCollection filteredNames = new clsSupplyCollection(); //apply a name that doesnt exist filteredNames.ReportByName("nie ma takeigo"); // test to see that there are no records Assert.AreEqual(0, filteredNames.Count); }
public void ReportByNameMethodOK() { clsSupplyCollection collection = new clsSupplyCollection(); clsSupplyCollection filteredNames = new clsSupplyCollection(); //apply a blank string (should return all records); filteredNames.ReportByName(""); // test to see that the two values are the same Assert.AreEqual(collection.Count, filteredNames.Count); }
protected void btnYes_Click(object sender, EventArgs e) { clsSupplyCollection collection = new clsSupplyCollection(); //find the record to delete collection.ThisSupply.Find(ProductID); //delete the record collection.Delete(); //redirect back to the main page Response.Redirect("SupplyList.aspx"); }
void DisplaySuppliers() { clsSupplyCollection Suppliers = new clsSupplyCollection(); //set the data source to the list of the to the list of names in the collection lstSuppliers.DataSource = Suppliers.SupplyList; //set the name of the primary key lstSuppliers.DataValueField = "ProductID"; //set the field to display lstSuppliers.DataTextField = "Name"; //bind the data to the list lstSuppliers.DataBind(); }
void DisplaySupplies() { clsSupplyCollection Supplies = new clsSupplyCollection(); Supplies.ThisSupply.Find(ProductID); //display the edata for this record txtProductID.Text = Supplies.ThisSupply.ProductID.ToString(); txtName.Text = Supplies.ThisSupply.Name; txtPrice.Text = Supplies.ThisSupply.Price.ToString(); txtQuantity.Text = Supplies.ThisSupply.Quantity.ToString(); txtDeliveryDate.Text = Supplies.ThisSupply.DeliveryDate.ToString(); chkInStock.Checked = Supplies.ThisSupply.InStock; }
public void AddMethodOK() { clsSupplyCollection collection = new clsSupplyCollection(); clsSupply TestClass = new clsSupply(); TestClass.InStock = true; TestClass.Name = "cos tamno"; TestClass.Price = 43; TestClass.Quantity = 22; TestClass.DeliveryDate = DateTime.Now.Date; collection.ThisSupply = TestClass; Int32 PrimaryKey = collection.Add(); PrimaryKey = TestClass.ProductID; Assert.AreEqual(collection.ThisSupply, TestClass); }
public void ListandCountOK() { clsSupplyCollection allSupply = new clsSupplyCollection(); List <clsSupply> testList = new List <clsSupply>(); clsSupply Supplier = new clsSupply(); Supplier.InStock = true; Supplier.Price = 3; Supplier.ProductID = 5; Supplier.Quantity = 6; Supplier.Name = " lolo"; Supplier.DeliveryDate = DateTime.Now.Date; testList.Add(Supplier); allSupply.SupplyList = testList; Assert.AreEqual(allSupply.Count, testList.Count); }
protected void btnOK_Click(object sender, EventArgs e) { //create a new instance of clsSupply clsSupply TheSupplier = new clsSupply(); // capture the id string id = txtProductID.Text; string Name = txtName.Text; string Quantity = txtQuantity.Text; string DeliveryDate = txtDeliveryDate.Text; string Price = txtPrice.Text; string error = ""; error = TheSupplier.Valid(id, Quantity, Name, Price, DeliveryDate); if (error == "") { TheSupplier.ProductID = ProductID; TheSupplier.Price = Convert.ToInt32(Price); TheSupplier.DeliveryDate = Convert.ToDateTime(DeliveryDate); TheSupplier.Quantity = Convert.ToInt32(Quantity); TheSupplier.Name = Name; TheSupplier.InStock = chkInStock.Checked; //Store the addres in the session object //Session["TheSupplier"] = TheSupplier; clsSupplyCollection colelction = new clsSupplyCollection(); if (ProductID == -1) { colelction.ThisSupply = TheSupplier; colelction.Add(); } else { colelction.ThisSupply.Find(ProductID); colelction.ThisSupply = TheSupplier; colelction.Update(); } //navigate to the viewer page Response.Redirect("SupplyList.aspx"); } else { lblError.Text = error; } }
public void DeleteMethodOK() { clsSupplyCollection collection = new clsSupplyCollection(); clsSupply TestClass = new clsSupply(); TestClass.InStock = true; TestClass.Name = "cos tamno"; TestClass.Price = 43; TestClass.Quantity = 22; TestClass.DeliveryDate = DateTime.Now.Date; collection.ThisSupply = TestClass; Int32 PrimaryKey = collection.Add(); TestClass.ProductID = PrimaryKey; collection.Delete(); Boolean Found = collection.ThisSupply.Find(PrimaryKey); Assert.IsFalse(Found); }
public void InstanceOK() { clsSupplyCollection ded = new clsSupplyCollection(); Assert.IsNotNull(ded); }
public void TestClassCollectionSupplyOK() { clsSupplyCollection list = new clsSupplyCollection(); Assert.IsNotNull(list); }