예제 #1
0
        public void DateAddedMinPlusOne()
        {
            //create an instance of the class we want to create
            clsSaleItem ASaleItem = new clsSaleItem();
            //boolean variable to store the result of the validation
            String Error = "";
            //create some test data to pass to the method
            int      ItemID    = 1;
            decimal  ItemPrice = 1.99m;
            int      Quantity  = 2;
            int      SaleID    = 1;
            DateTime DateAdded = (DateTime.Now.Date).AddDays(1);

            //invoke the method
            Error = ASaleItem.Valid(ItemID, ItemPrice, Quantity, SaleID, DateAdded);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
예제 #2
0
        public void ValidMethodOK()
        {
            //create an instance of the class we want to create
            clsSaleItem ASaleItem = new clsSaleItem();
            //string variable to store any error message
            string Error = "";
            //create some test data to pass to the method
            int      ItemID    = 1;
            decimal  ItemPrice = 1.99m;
            int      Quantity  = 2;
            int      SaleID    = 1;
            DateTime DateAdded = DateTime.Now.Date;

            //invoke the method
            Error = ASaleItem.Valid(ItemID, ItemPrice, Quantity, SaleID, DateAdded);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }