Exemple #1
0
        public void ReportByItemNameMethodOK()
        {
            //create an instance of the filtered data
            Boolean OK = true;
            //create anm instance of the filtered data
            clsOrderCollection FilteredItems = new clsOrderCollection();

            //apply a blank string (should return all records)
            FilteredItems.ReportByItemName("yyy yyy");
            //check that the correct number of records are found
            if (FilteredItems.Count == 2)
            {
                //check the first record is ID 322341
                if (FilteredItems.OrderList[0].OrderId != 322341)
                {
                    OK = false;
                }
                //check the first record is ID 322342
                if (FilteredItems.OrderList[1].OrderId != 322342)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are no records
            Assert.IsTrue(OK);
        }
Exemple #2
0
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderCollection AllOrders = new clsOrderCollection();

            //create the item of test data
            clsOrder TestItem = new clsOrder();

            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.OrderId       = 123;
            TestItem.ItemName      = "Test Item";
            TestItem.Price         = 22.22;
            TestItem.DateOrderMade = DateTime.Now.Date;
            TestItem.ItemShipped   = true;

            //set ThisOrder to the test data
            AllOrders.ThisOrder = TestItem;

            //add the record
            PrimaryKey = AllOrders.Add();

            //set the primary key of the test data
            TestItem.OrderId = PrimaryKey;

            //find the record
            AllOrders.ThisOrder.Find(PrimaryKey);

            //test to see that the two values are the same
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Exemple #3
0
        public void ReportByKeyTypeMethodOK()
        {
            clsOrderCollection OrderList    = new clsOrderCollection();
            clsOrderCollection FilteredList = new clsOrderCollection();

            FilteredList.ReportByKeyType("");
            Assert.AreEqual(OrderList.Count, FilteredList.Count);
        }
Exemple #4
0
        public void InstanceOK()
        {
            //create an instance of the class we want to create
            clsOrderCollection AllOrders = new clsOrderCollection();

            //test to see that it exists
            Assert.IsNotNull(AllOrders);
        }
Exemple #5
0
        public void ReportByItemNameNoneFound()
        {
            //create an instance of the filtered data
            clsOrderCollection FilteredItems = new clsOrderCollection();

            //apply a blank string (should return all records)
            FilteredItems.ReportByItemName("xxx xxx");
            //test to see that the two values are the same
            Assert.AreEqual(0, FilteredItems.Count);
        }
Exemple #6
0
        public void ThisOrderPropertyOK()
        {
            clsOrderCollection AllOrders = new clsOrderCollection();
            clsOrder           TestItem  = new clsOrder();

            TestItem.OrderNum         = 1;
            TestItem.CustomerNum      = 5;
            TestItem.ItemNum          = 7;
            TestItem.DateFinalised    = DateTime.Now.Date;
            TestItem.StandaloneOrSet  = "Set";
            TestItem.Quantity         = 1;
            TestItem.TotalPrice       = 14.99;
            TestItem.ReadyForShipping = true;
            AllOrders.ThisOrder       = TestItem;
            Assert.AreEqual(AllOrders.ThisOrder, TestItem);
        }
Exemple #7
0
        public void ListAndCountOK()
        {
            clsOrderCollection AllOrders = new clsOrderCollection();
            List <clsOrder>    TestList  = new List <clsOrder>();
            clsOrder           TestItem  = new clsOrder();

            TestItem.OrderNum         = 1;
            TestItem.CustomerNum      = 5;
            TestItem.ItemNum          = 7;
            TestItem.DateFinalised    = DateTime.Now.Date;
            TestItem.StandaloneOrSet  = "Set";
            TestItem.Quantity         = 1;
            TestItem.TotalPrice       = 14.99;
            TestItem.ReadyForShipping = true;
            TestList.Add(TestItem);
            AllOrders.OrderList = TestList;
            Assert.AreEqual(AllOrders.Count, TestList.Count);
        }
Exemple #8
0
        public void ThisOrderPropertyOK()
        {
            //create an instance of the class we want to create
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create some data to assign to the property
            clsOrder TestOrder = new clsOrder();

            //set properties of test Order
            TestOrder.OrderId       = 1111;
            TestOrder.ItemName      = "Test Item";
            TestOrder.ItemShipped   = true;
            TestOrder.Price         = 22.22;
            TestOrder.DateOrderMade = DateTime.Now.Date;
            //assign the data to the property
            AllOrders.ThisOrder = TestOrder;
            //test to see that the two values are the same
            Assert.AreEqual(AllOrders.ThisOrder, TestOrder);
        }
Exemple #9
0
        public void AddMethodOK()
        {
            clsOrderCollection AllOrders = new clsOrderCollection();
            clsOrder           AnOrder   = new clsOrder();
            Int32 PrimaryKey             = 0;

            AnOrder.CustomerNum      = 5;
            AnOrder.ItemNum          = 6;
            AnOrder.DateFinalised    = DateTime.Now.Date;
            AnOrder.StandaloneOrSet  = "Standalone";
            AnOrder.TotalPrice       = 6.98;
            AnOrder.Quantity         = 2;
            AnOrder.ReadyForShipping = true;
            AllOrders.ThisOrder      = AnOrder;
            PrimaryKey       = AllOrders.Add();
            AnOrder.OrderNum = PrimaryKey;
            AllOrders.ThisOrder.Find(PrimaryKey);
            Assert.AreEqual(AllOrders.ThisOrder, AnOrder);
        }
Exemple #10
0
        public void DeleteMethodOK()
        {
            clsOrderCollection OrderList = new clsOrderCollection();
            clsOrder           AnOrder   = new clsOrder();
            Int32 PrimaryKey             = 0;

            AnOrder.CustomerNum      = 1;
            AnOrder.ItemNum          = 1;
            AnOrder.DateFinalised    = DateTime.Now.Date;
            AnOrder.StandaloneOrSet  = "Standalone";
            AnOrder.TotalPrice       = 2.98;
            AnOrder.Quantity         = 2;
            AnOrder.ReadyForShipping = true;
            OrderList.ThisOrder      = AnOrder;
            PrimaryKey       = OrderList.Add();
            AnOrder.OrderNum = PrimaryKey;
            OrderList.ThisOrder.Find(PrimaryKey);
            OrderList.Delete();
            Boolean Found = OrderList.ThisOrder.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }
Exemple #11
0
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create item of test data
            clsOrder TestItem = new clsOrder();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.OrderId       = 1234;
            TestItem.ItemName      = "Test Item3";
            TestItem.Price         = 33.22;
            TestItem.DateOrderMade = DateTime.Now.Date;
            TestItem.ItemShipped   = true;

            //set ThisOrder to the test data
            AllOrders.ThisOrder = TestItem;

            //add the record
            PrimaryKey = AllOrders.Add();

            //set the primary key of the test data
            TestItem.OrderId = PrimaryKey;

            //find the record
            AllOrders.ThisOrder.Find(PrimaryKey);

            //delete the record
            AllOrders.Delete();

            //now find the record
            Boolean Found = AllOrders.ThisOrder.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
Exemple #12
0
        public void ListAndCountOK()
        {
            //create an instance of the class we want to create
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create some test data to assign to the property
            //in this case the data needs to be a list of objects
            List <clsOrder> TestList = new List <clsOrder>();
            //add an item to the list
            //create the item of test data
            clsOrder TestItem = new clsOrder();

            //set its properties
            TestItem.OrderId       = 1111;
            TestItem.ItemName      = "Test Item";
            TestItem.ItemShipped   = true;
            TestItem.Price         = 22.22;
            TestItem.DateOrderMade = DateTime.Now.Date;
            //add the item to the list
            TestList.Add(TestItem);
            //assign the data to the property
            AllOrders.OrderList = TestList;
            //Test to see that the two values are the same
            Assert.AreEqual(AllOrders.Count, TestList.Count);
        }
Exemple #13
0
        public void InstanceOK()
        {
            clsOrderCollection AllOrders = new clsOrderCollection();

            Assert.IsNotNull(AllOrders);
        }