Exemplo n.º 1
0
        public void ReportByPostCodeTestDataFound()
        {
            //create an insatcne of the filrted data
            clsStockCollection FilteredStocks = new clsStockCollection();
            //var to store outcome
            Boolean OK = true;

            //apply a post code that doesnt exist
            FilteredStocks.ReportByCarModel("yyy");
            //check that the correct number of records are found
            if (FilteredStocks.Count == 2)
            {
                //check that the first record is ID 36
                if (FilteredStocks.StockList[0].ModelNo != 149)
                {
                    OK = false;
                }
                //check that the first record is ID 150
                if (FilteredStocks.StockList[1].ModelNo != 150)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are no records
            Assert.IsTrue(OK);
        }
Exemplo n.º 2
0
    Int32 DisplayStocks(string CarModelFilter)
    {
        Int32    ModelNo;  //var to store the primary key
        string   CarModel; //var to store the phone type
        string   BHP;      //var to store the phone number
        DateTime DateAdded;
        //; //create an onstance of the phone book class
        //create an instance of the phone collection class
        clsStockCollection StockBook = new clsStockCollection();

        StockBook.ReportByCarModel(CarModelFilter);
        Int32 RecordCount;                                    // var to store the count of records
        Int32 Index = 0;                                      // var to store the index for the loop

        RecordCount = StockBook.Count;                        // get the count of records
        lstStock.Items.Clear();
        while (Index < RecordCount)                           // while there are records to process
        {
            ModelNo   = StockBook.StockList[Index].ModelNo;   // get the primary key
            CarModel  = StockBook.StockList[Index].CarModel;  // get the phone type
            BHP       = StockBook.StockList[Index].BHP;       // get the phone name
            DateAdded = StockBook.StockList[Index].DateAdded; // get the phone name
            //create a new entry for the list box
            ListItem NewEntry = new ListItem(CarModel + " " + BHP + " " + DateAdded, ModelNo.ToString());
            lstStock.Items.Add(NewEntry); // ADD THE PHONE TO THE LIST
            Index++;
        }
        return(RecordCount); //return the count of records found
    }
Exemplo n.º 3
0
        public void ReportByCarModelNoneFound()
        {
            clsStockCollection FilteredStocks = new clsStockCollection();

            //apply for a car model that dont exsist
            FilteredStocks.ReportByCarModel("xxxxxxxx x xxx");
            //test t o see that there are no records
            Assert.AreEqual(0, FilteredStocks.Count);
        }
Exemplo n.º 4
0
        public void ReportByCarModelMethodOK()
        {
            //create an instance of the class containing unflitered results
            clsStockCollection AllStocks = new clsStockCollection();
            //create an instance of the filtered data
            clsStockCollection FilteredStocks = new clsStockCollection();

            //apply a bank string (should return all records);
            FilteredStocks.ReportByCarModel("");
            //test to see that the two values are the same
            Assert.AreEqual(AllStocks.Count, FilteredStocks.Count);
        }