protected void btnSubmit_Click(object sender, EventArgs e) { if (Page.IsValid) { string title = txtTitle.Text; string desc = txtDescription.Text; string key = txtKeywords.Text; string bugReporter = Session["loginID"].ToString(); BugClass bc = new BugClass(); bc.bugReporter = bugReporter; bc.title = title; bc.keywords = key; bc.description = desc; bc.category = ddlCategory.SelectedValue; if (bc.addBug() == 0) { lblError.InnerText = "Bug report submitted."; clearInput(); } else { lblError.InnerText = "Error in bug submission."; } } else { lblError.InnerText = "*Fill up your bug report!"; } }
public void TestSubmitBug() { string bugReporter = ""; string title = "Unable to add new item to checkout"; string keywords = "cart checkout check out"; string description = "add one item to cart > go to product A via the search bar > add new item to cart via 'add to cart' > go to cart"; DateTime date_reported = DateTime.Now; string category = "UI"; string status = "New"; BugClass bc = new BugClass(); bc.bugReporter = bugReporter; bc.title = title; bc.keywords = keywords; bc.description = description; bc.dateReported = date_reported; bc.category = category; bc.status = status; Assert.AreEqual(bc.addBug(), 0); }