Exemple #1
0
        public void TestUpdatePartOK()
        {
            SetUpDB();
            PartMapper pm = new PartMapper();
            Part       p  = pm.GetPart(2, conn);

            p.price = 1000.50m;
            int  rowsupdated = pm.UpdatePart(p, conn);
            Part pnew        = pm.GetPart(2, conn);

            TearDown();
            Assert.AreEqual(rowsupdated, 1);
            Assert.AreEqual(pnew.price, 1000.50m);
        }
Exemple #2
0
        public void TestGetPartFail()
        {
            SetUpDB();
            PartMapper pm = new PartMapper();
            Part       p  = pm.GetPart(4, conn);

            TearDown();
            Assert.AreEqual(p, null);
        }
Exemple #3
0
        public void TestGetPartOK()
        {
            SetUpDB();
            PartMapper pm = new PartMapper();
            Part       p  = pm.GetPart(2, conn);

            TearDown();
            Assert.AreEqual(p.partno, 2);
        }
Exemple #4
0
        public void TestDeletePartOK()
        {
            SetUpDB();
            PartMapper pm          = new PartMapper();
            int        rowsupdated = pm.DeletePart(2, conn);
            Part       p           = pm.GetPart(2, conn);

            TearDown();
            Assert.AreEqual(rowsupdated, 1);
            Assert.AreEqual(p, null);
        }
Exemple #5
0
        public void TestCreatePartOK()
        {
            SetUpDB();
            PartMapper pm          = new PartMapper();
            Part       p           = new Part(4, "PartD", 34.50m, 25);
            int        rowsupdated = pm.InsertPart(p, conn);
            Part       pnew        = pm.GetPart(4, conn);

            TearDown();
            Assert.AreEqual(rowsupdated, 1);
            Assert.AreEqual(pnew.partname, "PartD");
        }
Exemple #6
0
        public void TestUpdatePartFail()
        {
            SetUpDB();
            PartMapper pm = new PartMapper();
            Part       p  = pm.GetPart(2, conn);

            p.partno = 4;
            int rowsupdated = pm.UpdatePart(p, conn);

            TearDown();
            Assert.AreEqual(rowsupdated, 0);
        }