コード例 #1
0
        public void AddFineTest()
        {
            student_fine sf = new student_fine();

            sf.StudentID = "101"; sf.FineAmount = 5.0;
            Student s   = new Student();
            Books   b   = new Books();
            bool    res = false;

            if (s.StudentExists(sf.StudentID, dbpath))
            {
                res = sf.AddFine(sf, dbpath);
            }
            Assert.AreEqual(res, true);
        }
コード例 #2
0
        public void GetTotalFineTest()
        {
            student_fine sf  = new student_fine();
            DbCon        con = new DbCon();

            sf.StudentID = "101"; sf.FineAmount = 5.0;
            Student s   = new Student();
            Books   b   = new Books();
            bool    res = false;

            if (s.StudentExists(sf.StudentID, dbpath))
            {
                DataRowCollection dr = con.ExecuteSelectCommand("Select fineamount from student_fine where studentID='" + sf.StudentID + "'");
                sf.FineAmount += Convert.ToDouble(dr[0].ItemArray[0].ToString());
                res            = sf.updateFine(sf, dbpath);
            }
            Assert.AreEqual(res, true);
        }