public void AddDescription_WhenCalled_VarifyTheRightCommandBeingCalled() { var command = String.Format("Update Student Set Description = '{0}' where StudentCode = '{1}'", description, studentCode); _studentService.AdDescription(studentCode, description); _myDbAccess.Verify(db => db.Insert(command, _connectionString), Times.Once); }
protected void SubmitBtn_Click(object sender, EventArgs e) { var studentCode = Convert.ToString(Session["StudentCode"]); string description = DescriptionBox.Text; if (studentService.AdDescription(studentCode, description)) { myGrid.DataSource = GetStudentByStudentCode(); myGrid.DataBind(); DescriptionBox.Text = null; } else { Response.Redirect(@"\Student\StudentPage.aspx"); } }