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); }
protected void Page_Load(object sender, EventArgs e) { //create a new instance of clsSupply clsSupply TheSupplier = new clsSupply(); TheSupplier = (clsSupply)Session["TheSupplier"]; //display the Supplier Name for this entry Response.Write(TheSupplier.Name); }
public void DeliveryDateAddedPropertyOK() { clsSupply TheSupplier = new clsSupply(); DateTime TestData = DateTime.Now.Date; //assign the data to the property TheSupplier.DeliveryDate = TestData; Assert.AreEqual(TheSupplier.DeliveryDate, TestData); }
public void QuantityNoPropertyOK() { //create an instance of the class we want to create clsSupply TheSupplier = new clsSupply(); //create some test data to assign to the property Int32 TestData = 1; //assign the data to the property // TheSupplier.QuantityNo = TestData; //test to see that the two values are the same // Assert.AreEqual(TheSupplier.QuantityNo, TestData); }
public void ProductNamePropertyOK() { clsSupply TheSupplier = new clsSupply(); //create some test data to assign to the property string TestData = "Name"; //assign the data to the property TheSupplier.Name = TestData; //test to see that the two values are the same Assert.AreEqual(TheSupplier.Name, TestData); }
public void QuantityInvalidDataType() { clsSupply Supplier = new clsSupply(); String Error = ""; string SupplierPrice = "ten pounds"; // Error = string SupplierInStock, string SupplierName, string SupplierPrice) Assert.AreNotEqual(Error, ""); }
public void PricePropertyOK() { //create an instance of the class we want to create clsSupply TheSupplier = new clsSupply(); //create some test data to assign to the property double TestData = 1.5; //assign the data to the property TheSupplier.Price = TestData; //test to see that the two values are the same Assert.AreEqual(TheSupplier.Price, TestData); }
public void InStockPropertyOK() { // create an instance of the class we want ot create clsSupply TheSupplier = new clsSupply(); //create some test data Boolean TestData = true; //assign the data to the property TheSupplier.InStock = TestData; //tesr to see if the two values are the samme Assert.AreEqual(TheSupplier.InStock, TestData); }
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 TestNameFound() { clsSupply Supplier = new clsSupply(); // Boolean Found = false; Boolean OK = true; //Int32 CustomerID = 21; // Found = ACustomer.Find(CustomerID); // if (ACustomer.CustomerFullName != "Diogo Rodrigues") { OK = false; } Assert.IsTrue(OK); }
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 TestSupplierIDFound() { clsSupply Supplier = new clsSupply(); // Boolean Found = false; Boolean OK = true; //Int32 CustomerID = 21; // Found = aCustomer.Find(CustomerID); //if (aCustomer.CustomerID != 21) { OK = false; } Assert.IsTrue(OK); }
public void InStockFound() { clsSupply Supplier = new clsSupply(); Boolean Found = false; Boolean OK = true; Int32 ProductID = 2; Found = Supplier.Find(ProductID); if (Supplier.InStock != true) { OK = false; } Assert.IsTrue(OK); }
public void TestDeliveryDateFound() { clsSupply Supplier = new clsSupply(); Boolean Found = false; Boolean OK = true; Int32 ProductID = 2; Found = Supplier.Find(ProductID); if (Supplier.DeliveryDate != Convert.ToDateTime("15/04/2021")) { OK = false; } Assert.IsTrue(OK); }
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 TestQuantityFound() { clsSupply Supplier = new clsSupply(); Boolean Found = false; Boolean OKs = true; Int32 ProductID = 2; Found = Supplier.Find(ProductID); if (Supplier.Quantity != 3213) { OKs = false; } Assert.IsTrue(OKs); }
protected void btnFind_Click(object sender, EventArgs e) { clsSupply Supplier = new clsSupply(); Int32 ProductID; Boolean Found = false; ProductID = Convert.ToInt32(txtProductID.Text); Found = Supplier.Find(ProductID); if (Found == true) { txtName.Text = Supplier.Name.ToString(); txtDeliveryDate.Text = Supplier.DeliveryDate.ToString(); txtPrice.Text = Supplier.Price.ToString(); txtQuantity.Text = Supplier.Quantity.ToString(); chkInStock.Checked = Supplier.InStock; } }
public void InstanceOK() { clsSupply TheSupplier = new clsSupply(); Assert.IsNotNull(TheSupplier); }