public void TestFindMethod() { clsBrand ABrand = new clsBrand(); Boolean Found = false; Int32 Id = 1395; Found = ABrand.Find(Id); Assert.IsTrue(Found); }
public void TestIsListedFound() { clsBrand ABrand = new clsBrand(); Boolean Found = false; Boolean OK = true; Int32 Id = 1395; Found = ABrand.Find(Id); if (ABrand.IsListed != false) { OK = false; } Assert.IsTrue(OK); }
public void TestAvgPriceFound() { clsBrand ABrand = new clsBrand(); Boolean Found = false; Boolean OK = true; Int32 Id = 3; Found = ABrand.Find(Id); if (ABrand.AvgPrice != 0.00) { OK = false; } Assert.IsTrue(OK); }
public void TestLastRestockFound() { clsBrand ABrand = new clsBrand(); Boolean Found = false; Boolean OK = true; Int32 Id = 1395; Found = ABrand.Find(Id); if (ABrand.LastRestock != Convert.ToDateTime("06/05/2021")) { OK = false; } Assert.IsTrue(OK); }
public void TestLatestProductFound() { clsBrand ABrand = new clsBrand(); Boolean Found = false; Boolean OK = true; Int32 Id = 1395; Found = ABrand.Find(Id); if (ABrand.LatestProduct != 2) { OK = false; } Assert.IsTrue(OK); }
public void TestBrandNameFound() { clsBrand ABrand = new clsBrand(); Boolean Found = false; Boolean OK = true; Int32 Id = 1395; Found = ABrand.Find(Id); if (ABrand.BrandName != "TestBrandInc") { OK = false; } Assert.IsTrue(OK); }
protected void btnFind_Click(object sender, EventArgs e) { clsBrand brand = new clsBrand(); // variable to store PK Int32 BrandId; // var to store return value of Find() Boolean Found = false; //Get PK from user input as Int32 obj try { BrandId = Convert.ToInt32(tbBrandID.Text); Found = brand.Find(BrandId); } catch (Exception) { lblErrorAlert.Visible = true; lblErrorAlert.Text = "Invalid Brand ID: This field must be a positive integer."; return; } if (Found) { // set the properties of the found brand to appear in the data form tbName.Text = brand.BrandName; dropTop.SelectedValue = brand.TopProduct.ToString(); dropLatest.SelectedValue = brand.LatestProduct.ToString(); cdrRestock.SelectedDate = brand.LastRestock; cdrRestock.Visible = true; lblSelectedDate.Text = brand.LastRestock.ToString("dd/MM/yyyy"); cbList.Checked = brand.IsListed; lblErrorAlert.Text = ""; lblErrorAlert.Visible = false; } else { lblErrorAlert.Visible = true; lblErrorAlert.Text = "Brand " + tbName.Text + " was not found in the database."; } }