Esempio n. 1
0
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsBookingsCollection AllBookings = new clsBookingsCollection();
            //create an instance of test data
            clsBookings TestItem = new clsBookings();
            //var to store primary key
            Int32 PK = 0;

            //set the properties
            //TestItem.BookRef = 3;
            TestItem.Ammount     = Convert.ToInt32(9756.24);
            TestItem.DateBooked  = DateTime.Now.Date;
            TestItem.PaymentType = "Debit";
            TestItem.CustID      = '2';
            //set ThisBooking to validate test data
            AllBookings.ThisBookings = TestItem;
            //add the record
            PK = AllBookings.Add();
            //set primary key of test data
            TestItem.BookRef = PK;
            //find the record
            AllBookings.ThisBookings.Find(PK);
            //delete the record
            AllBookings.Delete();
            //now find the record
            Boolean Found = AllBookings.ThisBookings.Find(PK);

            //test to see that it exists
            Assert.IsFalse(Found);
        }
Esempio n. 2
0
        public void AddMethodOK()
        {
            //instance of collection class
            clsBookingCollection AllBookings = new clsBookingCollection();
            //test data
            clsBookings TestItem = new clsBookings();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.BookingNo      = 1;
            TestItem.CustomerNo     = 1;
            TestItem.TourNo         = 1;
            TestItem.DateandTime    = DateTime.Now.Date;
            TestItem.PassengerCount = 1;
            //set thisBooking to the test data
            AllBookings.ThisBooking = TestItem;
            //add recprd
            PrimaryKey = AllBookings.Add;
            //set the primary key of the test data
            TestItem.BookingNo = PrimaryKey;
            //find the record
            AllBookings.ThisBooking.Find(PrimaryKey);
            //test to see that th
            //e two values are the same
            Assert.AreEqual(AllBookings.ThisBooking, TestItem);
        }
Esempio n. 3
0
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsBookingsCollection AllBookings = new clsBookingsCollection();
            //create an instance of test data
            clsBookings TestItem = new clsBookings();
            //var to store primary key
            Int32 PK = 0;

            //set the properties
            //TestItem.BookRef = 3;
            TestItem.Ammount     = Convert.ToInt32(8000.50);
            TestItem.DateBooked  = DateTime.Now.Date;
            TestItem.PaymentType = "Debit";
            TestItem.CustID      = 1;
            //set ThisBooking to validate test data
            AllBookings.ThisBookings = TestItem;
            //add the record
            PK = AllBookings.Add();
            //set primary key of test data
            TestItem.BookRef = PK;
            //find the record
            AllBookings.ThisBookings.Find(PK);
            //test to see that it exists
            Assert.AreEqual(AllBookings.ThisBookings, TestItem);
        }
        public void UpdateMethodOK()
        {
            //create an instance of the class we want to create
            clsBookingsCollection AllBookings = new clsBookingsCollection();
            //create an instance of test data
            clsBookings TestItem = new clsBookings();
            //var to store primary key
            Int32 PK = 0;

            //set the properties
            //TestItem.BookRef = 3;
            TestItem.Ammount     = 80;
            TestItem.DateBooked  = DateTime.Now.Date;
            TestItem.PaymentType = "Debit";
            //set ThisBooking to validate test data
            AllBookings.ThisBookings = TestItem;
            //add the record
            PK = AllBookings.Add();
            //set primary key of test data
            TestItem.BookRef = PK;
            //modify the record
            //TestItem.BookRef = 3;
            TestItem.Ammount     = 40;
            TestItem.DateBooked  = DateTime.Now.Date;
            TestItem.PaymentType = "Credit";
            //set the record based on the new record
            AllBookings.ThisBookings = TestItem;
            //update the record
            AllBookings.Update();
            //find the record
            AllBookings.ThisBookings.Find(PK);
            //test to see that it exists
            Assert.AreEqual(AllBookings.ThisBookings, TestItem);
        }
Esempio n. 5
0
        public void InstanceOK()
        {
            //create an instance of booking class
            clsBookings ABooking = new clsBookings();

            //test to see that it exists
            Assert.IsNotNull(ABooking);
        }
        public void InstanceOK()
        {
            //create a new instance of the class we want to create
            clsBookings ABookings = new clsBookings();

            //test to see if it exists
            Assert.IsNotNull(ABookings);
        }
        public void StartDateOK()
        {
            //create a new instance of the class we want to create
            clsBookings ABookings = new clsBookings();
            //create some test data
            DateTime StartDate = DateTime.Now.Date.AddDays(-365);

            ABookings.StartDate = StartDate;
            //test to see if it exists
            Assert.AreEqual(ABookings.StartDate, StartDate);
        }
        public void DateBookedOK()
        {
            //create a new instance of the class we want to create
            clsBookings ABookings = new clsBookings();
            //create some test data
            DateTime DateBooked = DateTime.Now.Date;

            ABookings.DateBooked = DateBooked;
            //test to see if it exists
            Assert.AreEqual(ABookings.DateBooked, DateBooked);
        }
        public void EndDateOK()
        {
            //create a new instance of the class we want to create
            clsBookings ABookings = new clsBookings();
            //create some test data
            DateTime EndDate = DateTime.Now.Date;

            ABookings.EndDate = EndDate;
            //test to see if it exists
            Assert.AreEqual(ABookings.EndDate, EndDate);
        }
        public void BookRefOK()
        {
            //create a new instance of the class we want to create
            clsBookings ABookings = new clsBookings();
            //create some test data
            Int32 BookRef = 1;

            ABookings.BookRef = BookRef;
            //test to see if it exists
            Assert.AreEqual(ABookings.BookRef, BookRef);
        }
        public void AmmountOK()
        {
            //create a new instance of the class we want to create
            clsBookings ABookings = new clsBookings();
            //create some test data
            decimal Ammount = Convert.ToDecimal("23.50");

            ABookings.Ammount = Ammount;
            //test to see if it exists
            Assert.AreEqual(ABookings.Ammount, Ammount);
        }
        public void PaymentOK()
        {
            //create a new instance of the class we want to create
            clsBookings ABookings = new clsBookings();
            //create some test data
            string PaymentType = "Credi";

            ABookings.PaymentType = PaymentType;
            //test to see if it exists
            Assert.AreEqual(ABookings.PaymentType, PaymentType);
        }
Esempio n. 13
0
        public void DateandTime()
        {
            //create an instance of booking class
            clsBookings ABooking = new clsBookings();
            //create some test data and assign it to the property
            DateTime TestData = DateTime.Now.Date;

            //assign the data to the property
            ABooking.DateandTime = TestData;
            //test to see if the values are the same
            Assert.AreEqual(ABooking.DateandTime, TestData);
        }
Esempio n. 14
0
        public void PassengerCount()
        {
            //instance of vooking class
            clsBookings ABooking = new clsBookings();
            //test data assigned to the property
            Int32 TestData = 1;

            //assign the data to the property
            ABooking.PassengerCount = TestData;
            //test tp see if the values are the same
            Assert.AreEqual(ABooking.PassengerCount, TestData);
        }
Esempio n. 15
0
        public void TourNoPropertyOK()
        {
            //create an instance of booking class
            clsBookings ABooking = new clsBookings();
            //create some test data and assign it to the property
            Int32 TestData = 1;

            //assign the data to the property
            ABooking.TourNo = TestData;
            //test to see if the values are the same
            Assert.AreEqual(ABooking.TourNo, TestData);
        }
Esempio n. 16
0
    void DisplayBooking(Int32 BookingNo)
    {
        //instance of booking clas
        clsBookings BookingList = new clsBookings();

        //find record to display
        BookingList.Find(BookingNo);
        //display the data
        txtCustomerNo.Text     = BookingList.CustomerNo.ToString();
        txtTourNo.Text         = BookingList.TourNo.ToString();
        txtDateandTime.Text    = BookingList.DateandTime.ToShortDateString();
        txtPassengerCount.Text = BookingList.PassengerCount.ToString();
    }
Esempio n. 17
0
        public void FilterbyDateOK()
        {
            clsBookings TestItem = new clsBookings();
            //create an instance of the class we want to create
            clsBookingsCollection AllBookings = new clsBookingsCollection();
            //create an instance of the filtered data
            clsBookingsCollection FilteredBookings = new clsBookingsCollection(" ");

            //apply a blank string (should return all records)
            FilteredBookings.FilterbyDateBooked(DateTime.Now.Date.AddYears(-50).ToString(), DateTime.Now.Date.ToString());
            //test to see the two values are the same
            Assert.AreEqual(AllBookings.Count, FilteredBookings.Count);
        }
Esempio n. 18
0
        public void FilterbySurnameNotFound()
        {
            clsBookings TestItem = new clsBookings();
            //create an instance of the class we want to create
            clsBookingsCollection AllBookings = new clsBookingsCollection();
            //create an instance of the filtered data
            clsBookingsCollection FilteredBookings = new clsBookingsCollection();

            //apply a blank string (should return all records)
            FilteredBookings.FilterSurname("!");
            //test to see the two values are the same
            Assert.AreEqual(0, FilteredBookings.Count);
        }
Esempio n. 19
0
        public void FindMethodOK()
        {
            //create an instance of booking class
            clsBookings ABooking = new clsBookings();
            //boolean variable to store the result of the validation
            Boolean Found = false;
            //create some tsest data to use with the method
            Int32 BookingNo = 1;

            //invoke the method
            Found = ABooking.Find(BookingNo);
            //test to see that the result is correct
            Assert.IsTrue(Found);
        }
        public void FindMethodOK()
        {
            //create a new instance of the class we want to create
            clsBookings ABookings = new clsBookings();
            //string variable to store result of validation
            Boolean Found = false;
            //create some test data to assign to property
            Int32 BookRef = 1;

            //invoke method
            Found = ABookings.Find(BookRef);
            //test to see if it exists
            Assert.IsTrue(Found);
        }
        public void ValidDateFilterEndDateinFuture()
        {
            //create a new instance of the class we want to create
            clsBookings ABookings = new clsBookings();
            //string variable to store result of validation
            string OK = "";
            //create some test data to assign to property
            string StartDate = DateTime.Now.Date.AddYears(-1).ToString();
            string EndDate   = DateTime.Now.Date.AddYears(1).ToString();

            //invoke method
            OK = ABookings.ValidDateFilter(StartDate, EndDate);
            //test to see if it exists
            Assert.AreNotEqual(OK, "");
        }
        public void ValidDateFilterInvalidData()
        {
            //create a new instance of the class we want to create
            clsBookings ABookings = new clsBookings();
            //string variable to store result of validation
            string OK = "";
            //create some test data to assign to property
            string StartDate = "dsffdsf";
            string EndDate   = "jdsjfjhdf";

            //invoke method
            OK = ABookings.ValidDateFilter(StartDate, EndDate);
            //test to see if it exists
            Assert.AreNotEqual(OK, "");
        }
        public void ValidExist()
        {
            //create a new instance of the class we want to create
            clsBookings ABookings = new clsBookings();
            //string variable to store result of validation
            string OK = "";
            //create some test data to assign to property
            string PaymentType = "LE";
            string Ammount     = "23.50";
            string DateBooked  = DateTime.Now.Date.ToString();

            //invoke method
            OK = ABookings.Valid(Ammount, DateBooked, PaymentType);
            //test to see if it exists
            Assert.AreEqual(OK, "");
        }
        public void BookingsAmmountInvalidData()
        {
            //create an instance of new class we want to create
            clsBookings ABookings = new clsBookings();
            //string variable to store the results of the validation
            string OK = "";
            //create some test data to assign to property
            string PaymentType = "a";
            string Ammount     = "sddfgthjjfghb";
            string DateBooked  = DateTime.Now.Date.ToString();

            //invoke method
            OK = ABookings.Valid(Ammount, DateBooked, PaymentType);
            //test to see if result correct
            Assert.AreNotEqual(OK, "");
        }
Esempio n. 25
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        //instance of cls booking
        clsBookings ThisBooking = new clsBookings();
        //variable to store error msg
        string ErrorMessage;

        //test data entered
        ErrorMessage = ThisBooking.BookingValid(txtCustomerNo.Text,
                                                txtTourNo.Text,
                                                txtPassengerCount.Text,
                                                txtDateandTime.Text);
        //if no errors
        if (ErrorMessage == "")
        {
            //instance of booking collection class
            clsBookingCollection BookingList = new clsBookingCollection();
            //insert new data
            if (BookingNo == -1)
            {
                //copy data from the interface to the object
                BookingList.ThisBooking.CustomerNo     = Convert.ToInt32(txtCustomerNo.Text);
                BookingList.ThisBooking.TourNo         = Convert.ToInt32(txtTourNo.Text);
                BookingList.ThisBooking.PassengerCount = Convert.ToInt32(txtPassengerCount.Text);
                BookingList.ThisBooking.DateandTime    = Convert.ToDateTime(txtDateandTime);
                //add the new record
                BookingList.Add();
            }
            else//update existing data
            {
                BookingList.ThisBooking.CustomerNo     = Convert.ToInt32(txtCustomerNo.Text);
                BookingList.ThisBooking.TourNo         = Convert.ToInt32(txtTourNo.Text);
                BookingList.ThisBooking.PassengerCount = Convert.ToInt32(txtPassengerCount.Text);
                BookingList.ThisBooking.DateandTime    = Convert.ToDateTime(txtDateandTime);
                //add the new record
                BookingList.Update();
            }
            //Redirect back to the bookings list
            Response.Redirect("StaffBooking.aspx");
        }
        else
        {
            //display error message
            lblError.Text = ErrorMessage;
        }
    }
Esempio n. 26
0
        public void ThisBookingPropertyOK()
        {
            //create an instance of the class we want to create
            clsBookingsCollection AllBookings = new clsBookingsCollection();
            //create some test data to assign to the property
            //add an item to the list
            clsBookings TestBooking = new clsBookings();

            //set its properties
            TestBooking.BookRef     = 1;
            TestBooking.Ammount     = 50;
            TestBooking.DateBooked  = DateTime.Now.Date;
            TestBooking.PaymentType = "Credit";
            //assign the data to the property
            AllBookings.ThisBookings = TestBooking;//test to see that it exists
            Assert.AreEqual(AllBookings.ThisBookings, TestBooking);
        }
        public void BookingsPaymentExtremeMax()
        {
            //create an instance of new class we want to create
            clsBookings ABookings = new clsBookings();
            //string variable to store the results of the validation
            string OK = "";
            //create some test data to assign to property
            string PaymentType = "";

            PaymentType = PaymentType.PadRight(100, 'a');
            string Ammount    = "23.50";
            string DateBooked = DateTime.Now.Date.ToString();

            //invoke method
            OK = ABookings.Valid(Ammount, DateBooked, PaymentType);
            //test to see if result correct
            Assert.AreNotEqual(OK, "");
        }
Esempio n. 28
0
        public void ThisBookingPropertyOK()
        {
            //instance of collection  class
            clsBookingCollection AllBookings = new clsBookingCollection();
            //test data t assign to the property
            clsBookings TestBooking = new clsBookings();

            //set the properties
            TestBooking.BookingNo      = 1;
            TestBooking.CustomerNo     = 1;
            TestBooking.TourNo         = 1;
            TestBooking.DateandTime    = DateTime.Now.Date;
            TestBooking.PassengerCount = 1;
            //assign the data to the property
            AllBookings.ThisBooking = TestBooking;
            //test to see that the two are the same
            Assert.AreEqual(AllBookings.ThisBooking, TestBooking);
        }
        public void TestFKCustIdFound()
        {
            //create a new instance of the class we want to create
            clsBookings ABookings = new clsBookings();
            //string variable to store result of validation
            Boolean Found = false;
            //bolean value if data is OK (assume it is)
            Boolean OK = true;
            //create some test data to assign to property
            Int32 BookRef = 1;

            //invoke method
            Found = ABookings.Find(BookRef);
            //check the booking no
            if (ABookings.CustID != 2)
            {
                OK = false;
            }
            //test to see if it exists
            Assert.IsTrue(OK);
        }
        public void BookingsDateBookedInvalidData()
        {
            //create an instance of new class we want to create
            clsBookings ABookings = new clsBookings();
            //string variable to store the results of the validation
            string OK = "";
            //create some test data to assign to property
            string PaymentType = "12345";
            string Ammount     = "23.50";
            //vaiable to store test date data
            string SomeDate;

            //set test date as todays daye
            SomeDate = "ytytyrtyr";
            string DateBooked = SomeDate.ToString();

            //invoke the method
            OK = ABookings.Valid(Ammount, DateBooked, PaymentType);
            //test to see if result correct
            Assert.AreNotEqual(OK, "");
        }