예제 #1
0
        public void ReportByOrderStatusDataFound()
        {
            //create an instance of the fildered data
            clsOrderCollection FilteredOrders = new clsOrderCollection();
            //var to store the outcome
            Boolean OK = true;

            //apply a status that doesn't exists
            FilteredOrders.ReportOrderStatus("Delivering");
            //check that the correct number of records are found
            if (FilteredOrders.Count == 2)
            {
                //check that the first record is ID 87
                if (FilteredOrders.OrderList[0].OrderID != 1)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are no records
            Assert.IsTrue(OK);
        }
예제 #2
0
        public void ReportByStatusNoneFound()
        {
            clsOrderCollection FilteredOrder = new clsOrderCollection();

            //apply a blank string (should return all records);
            FilteredOrder.ReportOrderStatus("xxx xxx");
            //test to see that there are no records
            Assert.AreEqual(0, FilteredOrder.Count);
        }
예제 #3
0
        public void ReportByStatusMethodOK()
        {
            //create an instance of the class containing unfiltered result
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create an instance of the filtered data
            clsOrderCollection FilteredOrder = new clsOrderCollection();

            //apply a blank string (should return all records);
            FilteredOrder.ReportOrderStatus("");
            //test to see that the two values are the same
            Assert.AreEqual(AllOrders.Count, FilteredOrder.Count);
        }
    Int32 DisplayOrders(string OrderStatusFilter)
    {
        Int32              OrderID;
        string             OrderStatus;
        clsOrderCollection Orders = new clsOrderCollection();

        Orders.ReportOrderStatus(OrderStatusFilter);
        Int32 RecordCount;
        Int32 Index = 0;

        RecordCount = Orders.Count;
        lstOrder.Items.Clear();
        while (Index < RecordCount)
        {
            OrderID     = Orders.OrderList[Index].OrderID;
            OrderStatus = Orders.OrderList[Index].OrderStatus;
            ListItem NewEntry = new ListItem(OrderStatus + " ", OrderID.ToString());
            lstOrder.Items.Add(NewEntry);
            Index++;
        }
        return(RecordCount);
    }