protected void Page_Load(object sender, EventArgs e) { clsQuality QualityControl = new clsQuality(); QualityControl = (clsQuality)Session["QualityControl"]; Response.Write(QualityControl.ProductName); }
public void ListAndCountOK() { clsQualityCollection AllProducts = new clsQualityCollection(); //create test data to assign the property //in this case the data needs to be a list of objects List <clsQuality> TestList = new List <clsQuality>(); //add item to list //create item of test data clsQuality TestItem = new clsQuality(); //set its properties TestItem.Defective = false; TestItem.ProductNo = 1; TestItem.StaffID = 1; TestItem.BatchNo = 1; TestItem.Grade = 'A'; TestItem.Date = DateTime.Now.Date; TestItem.ProductName = "Blue"; //add item to the test list TestList.Add(TestItem); //Assign the data to the property AllProducts.ProductList = TestList; //test to see that the two values are the same Assert.AreEqual(AllProducts.Count, TestList.Count); }
public void UpdateMethodOK() { clsQualityCollection AllProducts = new clsQualityCollection(); clsQuality TestItem = new clsQuality(); Int32 PrimaryKey = 1; TestItem.Defective = true; TestItem.ProductName = "Blue"; TestItem.StaffID = 1; TestItem.BatchNo = 1; TestItem.Grade = 'A'; TestItem.Date = DateTime.Now.Date; AllProducts.ThisProduct = TestItem; PrimaryKey = AllProducts.Add(); TestItem.ProductNo = PrimaryKey; //modify test data TestItem.ProductName = "Red"; TestItem.StaffID = 2; TestItem.BatchNo = 2; TestItem.Date = DateTime.Now.Date; TestItem.Grade = 'C'; TestItem.Defective = false; AllProducts.ThisProduct = TestItem; AllProducts.Update(); AllProducts.ThisProduct.Find(PrimaryKey); Assert.AreEqual(AllProducts.ThisProduct, TestItem); }
public void StaffIDPropertyOK() { clsQuality QualityControl = new clsQuality(); Int32 DataTest = 1; QualityControl.StaffID = DataTest; Assert.AreEqual(QualityControl.StaffID, DataTest); }
public void ProductNoPropertyOK() { clsQuality QualityControl = new clsQuality(); Int32 DataTest = 1; QualityControl.ProductNo = DataTest; Assert.AreEqual(QualityControl.ProductNo, DataTest); }
public void InstanceOK() { //creates instance of class clsQuality QualityControl = new clsQuality(); //tests to see if it exists Assert.IsNotNull(QualityControl); }
public void ProductNamePropertyOK() { clsQuality QualityControl = new clsQuality(); String DataTest = "Blue"; QualityControl.ProductName = DataTest; Assert.AreEqual(QualityControl.ProductName, DataTest); }
public void ValidMethodOK() { clsQuality QualityControl = new clsQuality(); String Error = ""; Error = QualityControl.Valid(ProductName, StaffID, BatchNo, Grade, Date, Defective); Assert.AreEqual(Error, ""); }
public void FindMethodOK() { clsQuality QualityControl = new clsQuality(); Boolean Found = false; Int32 ProductNo = 1; Found = QualityControl.Find(ProductNo); Assert.IsTrue(Found); }
public void ProductNameMaxPlusOne() { clsQuality QualityControl = new clsQuality(); String Error = ""; string ProductName = ""; Error = QualityControl.Valid(ProductName, StaffID, BatchNo, Grade, Date, Defective); Assert.AreNotEqual(Error, ""); }
protected void btnOK_Click(object sender, EventArgs e) { clsQuality QualityControl = new clsQuality(); QualityControl.ProductName = txtProductName.Text; Session["QualityControl"] = QualityControl; //navigate to viewer page Response.Redirect("QualityViewer.aspx"); }
public void ProductNameMid() { clsQuality QualityControl = new clsQuality(); String Error = ""; string ProductName = ""; ProductName = ProductName.PadRight(10, 'a'); Error = QualityControl.Valid(ProductName, StaffID, BatchNo, Grade, Date, Defective); Assert.AreNotEqual(Error, ""); }
public void GradePropertyOK() { //create class instance clsQuality QualityControl = new clsQuality(); //create test for property Char TestData = 'A'; //assign data to property QualityControl.Grade = TestData; //test for if they are equal Assert.AreEqual(QualityControl.Grade, TestData); }
public void DatePropertyOK() { //create instance of class clsQuality QualityControl = new clsQuality(); //create test with datatype DateTime DateTime TestData = DateTime.Now.Date; //Assign data with property QualityControl.Date = TestData; //Test to see if they are equal Assert.AreEqual(QualityControl.Date, TestData); }
public void DefectivePropertyOK() { //create instance of class clsQuality QualityControl = new clsQuality(); //create test data Boolean TestData = false; //assign data to property QualityControl.Defective = TestData; //test to see if values are the same Assert.AreEqual(QualityControl.Defective, TestData); }
public void TestDateFound() { clsQuality QualityControl = new clsQuality(); Boolean Found = false; Boolean OK = true; Int32 ProductNo = 1; Found = QualityControl.Find(ProductNo); if (QualityControl.Date != Convert.ToDateTime("01/01/2021")) { OK = false; } Assert.IsTrue(OK); }
public void TestBatchNoFound() { clsQuality QualityControl = new clsQuality(); Boolean Found = false; Boolean OK = true; Int32 ProductNo = 1; Found = QualityControl.Find(ProductNo); if (QualityControl.BatchNo != 1) { OK = false; } Assert.IsTrue(OK); }
public void TestDefectiveFound() { clsQuality QualityControl = new clsQuality(); Boolean Found = false; Boolean OK = true; Int32 ProductNo = 1; Found = QualityControl.Find(ProductNo); if (QualityControl.Defective != true) { OK = false; } Assert.IsTrue(OK); }
public void TestProductNameFound() { clsQuality QualityControl = new clsQuality(); Boolean Found = false; Boolean OK = true; Int32 ProductNo = 1; Found = QualityControl.Find(ProductNo); if (QualityControl.ProductName != "Blue") { OK = false; } Assert.IsTrue(OK); }
protected void btnFind_Click(object sender, EventArgs e) { clsQuality QualityControl = new clsQuality(); Int32 ProductNo; Boolean Found = false; ProductNo = Convert.ToInt32(txtProductNo.Text); Found = QualityControl.Find(ProductNo); if (Found == true) { txtStaffID.Text = QualityControl.StaffID.ToString(); txtBatchNo.Text = QualityControl.BatchNo.ToString(); txtGrade.Text = QualityControl.Grade.ToString(); txtDate.Text = QualityControl.Date.ToString(); txtProductName.Text = QualityControl.ProductName; } }
public void ThisProductPropertyOK() { clsQualityCollection AllProducts = new clsQualityCollection(); //create test data to assign the property //create item of test data clsQuality TestProduct = new clsQuality(); //set its properties TestProduct.Defective = false; TestProduct.ProductNo = 1; TestProduct.StaffID = 1; TestProduct.BatchNo = 1; TestProduct.Grade = 'A'; TestProduct.Date = DateTime.Now.Date; TestProduct.ProductName = "Blue"; //Assign the data to the property AllProducts.ThisProduct = TestProduct; //test to see that the two values are the same Assert.AreEqual(AllProducts.ThisProduct, TestProduct); }
public void DeleteMethodOK() { clsQualityCollection AllProducts = new clsQualityCollection(); clsQuality TestItem = new clsQuality(); Int32 PrimaryKey = 0; TestItem.Defective = true; TestItem.ProductNo = 1; TestItem.ProductName = "Blue"; TestItem.StaffID = 1; TestItem.BatchNo = 1; TestItem.Date = DateTime.Now.Date; TestItem.Grade = 'A'; AllProducts.ThisProduct = TestItem; PrimaryKey = AllProducts.Add(); TestItem.ProductNo = PrimaryKey; AllProducts.ThisProduct.Find(PrimaryKey); AllProducts.Delete(); Boolean Found = AllProducts.ThisProduct.Find(PrimaryKey); Assert.IsFalse(Found); }
protected void btnOK_Click(object sender, EventArgs e) { clsQuality QualityControl = new clsQuality(); string ProductName = txtProductName.Text; string ProductNo = txtProductNo.Text; //capture the StaffID string StaffID = txtStaffID.Text; //capture the Batch number string BatchNo = txtBatchNo.Text; string Grade = txtGrade.Text; string Date = txtDate.Text; // varlable to store any error messages string Error = ""; //validate the data Error = QualityControl.Valid(ProductNo, ProductName, StaffID, BatchNo, Grade, Date); if (Error == "") { QualityControl.ProductName = txtProductName.Text; QualityControl.StaffID = Convert.ToInt32(txtStaffID.Text); QualityControl.BatchNo = Convert.ToInt32(txtBatchNo.Text); QualityControl.Grade = Convert.ToChar(txtGrade.Text); QualityControl.Date = Convert.ToDateTime(txtDate.Text); QualityControl.Defective = chkDefective.Checked; QualityControl.ProductName = txtProductName.Text; clsQualityCollection ProductList = new clsQualityCollection(); ProductList.ThisProduct = QualityControl; ProductList.Add(); //navigate to viewer page Response.Redirect("QualityList.aspx"); } else { lblError.Text = Error; } }