Esempio n. 1
0
        public void AddMethodOK()
        {
            //create an instance of the class we want to creat
            clsDestinationCollection AllDestinations = new clsDestinationCollection();
            //create the item of test data
            clsDestination TestItem = new clsDestination();
            //var to store the primary key
            Int32 Primarykey = 0;

            //set its properties
            TestItem.DestinationID    = 1;
            TestItem.EndPointHouseNo  = "1";
            TestItem.EndPointPostCode = "LE2 2WX";
            TestItem.EndPointStreet   = "God Street";
            TestItem.EndPointTown     = "Leicester";
            TestItem.PickupTime       = DateTime.Now.Date;
            TestItem.DropoffTime      = DateTime.Now.Date;
            //set ThisDestination to the test data
            AllDestinations.ThisDestination = TestItem;
            //add the record
            Primarykey = AllDestinations.Add();
            //find the record
            AllDestinations.ThisDestination.Find(Primarykey);
            //test to see that the two valyes are the same
            Assert.AreEqual(AllDestinations.ThisDestination, TestItem);
        }
Esempio n. 2
0
        public void ListAndCountOk()
        {
            //create an instance of the class we want to creat
            clsDestinationCollection AllDestinations = new clsDestinationCollection();
            //create some test data to assign to the property
            //in this case the data needs to be a list of objects
            List <clsDestination> TestList = new List <clsDestination>();
            //add an item to the list
            //create the item of test data
            clsDestination TestItem = new clsDestination();

            //set its properties
            TestItem.DestinationID    = 1;
            TestItem.EndPointHouseNo  = "1";
            TestItem.EndPointPostCode = "LE2 2WX";
            TestItem.EndPointStreet   = "God Street";
            TestItem.EndPointTown     = "Leicester";
            TestItem.PickupTime       = DateTime.Now.Date;
            TestItem.DropoffTime      = DateTime.Now.Date;
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the date to the property
            AllDestinations.DestinationList = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(AllDestinations.Count, TestList.Count);
        }
        public void AddMethodOk()
        {
            // create an instance of the class we want to create
            clsDestinationCollection AllDestinations = new clsDestinationCollection();
            // create the item of test data
            clsDestination TestItem = new clsDestination();
            // primary key variable
            Int32 PrimaryKey = 0;

            // set its properties
            TestItem.DestinationID  = 1;
            TestItem.Destination    = "Rome";
            TestItem.PricePerPerson = 99;
            TestItem.DayOfFlight    = DateTime.Now.Date;
            TestItem.ReturnDate     = DateTime.Now.Date.AddDays(1);
            // set ThisDestination to the test data
            AllDestinations.ThisDestination = TestItem;
            // add the record
            PrimaryKey = AllDestinations.Add();
            // set the primary key of the test data
            TestItem.DestinationID = PrimaryKey;
            // find the record
            AllDestinations.ThisDestination.Find(PrimaryKey);
            // test to see that the two values are the same
            Assert.AreEqual(AllDestinations.ThisDestination, TestItem);
        }
Esempio n. 4
0
        public void InstanceOK()
        {
            //create an instance of the class we want to create
            clsDestination AnDestination = new clsDestination();

            //test to see that it exists
            Assert.IsNotNull(AnDestination);
        }
Esempio n. 5
0
        public void DestinationInstanceOK()
        {
            // create an instance of the class we want to create
            clsDestination Destination = new clsDestination();

            // make sure that it exists
            Assert.IsNotNull(Destination);
        }
Esempio n. 6
0
        public void DestinationIDPropertyOK()
        {
            //create an instance of the class we want to create
            clsDestination AnDestination = new clsDestination();
            //create some test data to assign to the property
            Int32 TestData = 1;

            //assign the data to the property
            AnDestination.DestinationID = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnDestination.DestinationID, TestData);
        }
Esempio n. 7
0
        public void DestinationNameOK()
        {
            // create an instance of the class we want to create
            clsDestination ADestination = new clsDestination();
            // create test data to assign to the property
            string Destination = "New York";

            // assign the data to the property
            ADestination.Destination = Destination;
            // test to see that the two values are the same
            Assert.AreEqual(ADestination.Destination, Destination);
        }
Esempio n. 8
0
        public void DestinationIDOK()
        {
            // create an instance of the class we want to create
            clsDestination ADestination = new clsDestination();
            // create test data to assign to the property
            Int32 ID = 1;

            // assign data to the property
            ADestination.DestinationID = ID;
            // test to see that the two values are the same
            Assert.AreEqual(ADestination.DestinationID, ID);
        }
Esempio n. 9
0
        public void DropoffTimePropertyOK()
        {
            //create an instance of the class we want to create
            clsDestination AnDestination = new clsDestination();
            //create some test data to assign to the property
            DateTime TestData = DateTime.Now.Date;

            //assign the data to the property
            AnDestination.DropoffTime = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnDestination.DropoffTime, TestData);
        }
Esempio n. 10
0
        public void PricePerPersonOK()
        {
            // create an instance of the class we want to create
            clsDestination ADestination = new clsDestination();
            // create test data to assign to the property
            decimal PricePerPerson = 5.5m;

            // assign the data to the property
            ADestination.PricePerPerson = PricePerPerson;
            // test to see that the two values are the same
            Assert.AreEqual(ADestination.PricePerPerson, PricePerPerson);
        }
Esempio n. 11
0
        public void ValidMethodOK()
        {
            //create an instance of the class we want to create
            clsDestination AnDestination = new clsDestination();
            //string variable to store any error message
            String Error = "";

            //invoke the method
            Error = AnDestination.Valid(EndPointHouseNo, EndPointPostCode, EndPointStreet, EndPointTown, PickupTime);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 12
0
        public void EndPointTownPropertyOK()
        {
            //create an instance of the class we want to create
            clsDestination AnDestination = new clsDestination();
            //create some test data to assign to the property
            String TestData = "Leicester";

            //assign the data to the property
            AnDestination.EndPointTown = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnDestination.EndPointTown, TestData);
        }
Esempio n. 13
0
        public void FindMethodOK()
        {
            //create an instance of the class we want to create
            clsDestination AnDestination = new clsDestination();
            //Boolean variable to store the result of the validation
            Boolean Found = false;
            //create some test data to use with the method
            Int32 DestinationID = 131;

            //invoke the method
            Found = AnDestination.Find(DestinationID);
            //test to see that the result is correct
            Assert.IsTrue(Found);
        }
Esempio n. 14
0
        public void DestinationFindMethodOK()
        {
            // create an instance of the class we want to create
            clsDestination ADestination = new clsDestination();
            // boolean variable to store the result of the validation
            Boolean Found = false;
            // create test data to assign to the property
            Int32 DestinationID = 5;

            // execute the method
            Found = ADestination.Find(DestinationID);
            // test to see that the result is correct
            Assert.IsTrue(Found);
        }
Esempio n. 15
0
        public void EndPointHouseNoMaxPlusOne()
        {
            //create an instance of the class we want to create
            clsDestination AnDestination = new clsDestination();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string EndPointHouseNo = "aaaaaaa"; //this should be ok

            //invoke the method
            Error = AnDestination.Valid(EndPointHouseNo, EndPointPostCode, EndPointStreet, EndPointTown, PickupTime);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 16
0
        public void ReturnDateOK()
        {
            // create an instance of the class we want to create
            clsDestination ADestination = new clsDestination();
            // create test data to assign to the property
            DateTime Flight = DateTime.Now.Date;

            // add 7 days onto the date
            Flight = Flight.AddDays(14);
            // assign data to the property
            ADestination.ReturnDate = Flight;
            // test to see that the two values are the same
            Assert.AreEqual(ADestination.ReturnDate, Flight);
        }
Esempio n. 17
0
        public void EndPointTownMaxLessOne()
        {
            //create an instance of the class we want to create
            clsDestination AnDestination = new clsDestination();
            //string variable to store any error message
            String Error = "";
            //this should fail
            string EndPointTown = "";

            EndPointTown = EndPointTown.PadRight(49, 'a');
            //invoke the method
            Error = AnDestination.Valid(EndPointHouseNo, EndPointPostCode, EndPointStreet, EndPointTown, PickupTime);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 18
0
        public void ReturnDateMinLessOne()
        {
            // create an instance of the class we want to create
            clsDestination ADestination = new clsDestination();
            // boolean variable to store the result of the validation
            Boolean OK = false;
            // create test data to assign to the property
            string  Destination = "Dubai";
            decimal Price       = 100000;
            string  Flight      = "20/03/2017";
            string  Return      = "19/03/2017";

            // execute the method
            OK = ADestination.Valid(Destination, Price, Flight, Return);
            // test to see that the result is correct
            Assert.IsFalse(OK);
        }
Esempio n. 19
0
        public void DestinationValidMethodOK()
        {
            // create an instance of the class we want to create
            clsDestination ADestination = new clsDestination();
            // boolean variable to store the result of the validation
            Boolean OK = false;
            // create test data to assign to the property
            string  Destination = "New York";
            decimal Price       = 100;
            string  Flight      = Convert.ToString(DateTime.Now.Date);
            string  Return      = Convert.ToString(DateTime.Now.Date.AddDays(1));

            // execute the method
            OK = ADestination.Valid(Destination, Price, Flight, Return);
            // test to see that the result is correct
            Assert.IsTrue(OK);
        }
        public void ThisDestinationPropertyOK()
        {
            // create an instance of the class we want to create
            clsDestinationCollection AllDestinations = new clsDestinationCollection();
            // create some test data to assign to the property
            clsDestination TestDestination = new clsDestination();

            // set the properties to the test object
            TestDestination.DestinationID  = 1;
            TestDestination.Destination    = "Rome";
            TestDestination.PricePerPerson = 99;
            TestDestination.DayOfFlight    = DateTime.Now.Date;
            TestDestination.ReturnDate     = DateTime.Now.Date.AddDays(1);
            // assign the data to the property
            AllDestinations.ThisDestination = TestDestination;
            // test to see that the two values are the same
            Assert.AreEqual(AllDestinations.ThisDestination, TestDestination);
        }
Esempio n. 21
0
        public void PickupMin()
        {
            //create an instance of the class we want to create
            clsDestination AnDestination = new clsDestination();
            //string variable to store any error message
            String Error = "";
            //create a variable to store the test date data
            DateTime TestDate;

            //set the date totodays date
            TestDate = DateTime.Now.Date;
            //convert the date variable to a string variable
            string PickupTime = TestDate.ToString();

            //invoke the method
            Error = AnDestination.Valid(EndPointHouseNo, EndPointPostCode, EndPointStreet, EndPointTown, PickupTime);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 22
0
        public void PickupTimeInvalidData()
        {
            //create an instance of the class we want to create
            clsDestination AnDestination = new clsDestination();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string EndPointHouseNo  = "43";
            string EndPointPostCode = "LE2 2BT";
            string EndPointStreet   = "Carterhatch Street";
            string EndPointTown     = "Leicester";
            string DropoffTime      = DateTime.Now.Date.ToString();
            //set the DropoffTime to a non data value
            string PickupTime = "This Is Not A Date!";

            //invoke the method
            Error = AnDestination.Valid(EndPointHouseNo, EndPointPostCode, EndPointStreet, EndPointTown, PickupTime);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 23
0
        public void ThisDestinationPropertyOK()
        {
            //create an instance of the class we want to create
            clsDestinationCollection AllDestinations = new clsDestinationCollection();
            //create some test data to assign to the property
            clsDestination TestDestination = new clsDestination();

            //set its properties
            TestDestination.DestinationID    = 1;
            TestDestination.EndPointHouseNo  = "1";
            TestDestination.EndPointPostCode = "LE2 2WX";
            TestDestination.EndPointStreet   = "God Street";
            TestDestination.EndPointTown     = "Leicester";
            TestDestination.PickupTime       = DateTime.Now.Date;
            TestDestination.DropoffTime      = DateTime.Now.Date;
            //assign the data to the property
            AllDestinations.ThisDestination = TestDestination;
            //test to see that the two values are the same
            Assert.AreEqual(AllDestinations.ThisDestination, TestDestination);
        }
Esempio n. 24
0
        public void TestPricePerPersonFound()
        {
            // create an instance of the class we want to create
            clsDestination ADestination = new clsDestination();
            // boolean variable to store the result of the validation
            Boolean Found = false;
            // boolean to record if data is ok
            Boolean OK = true;
            // create test data to use with the method
            Int32 DestinationID = 5;

            // execute the method
            Found = ADestination.Find(DestinationID);
            // check the property
            if (ADestination.PricePerPerson != 200)
            {
                OK = false;
            }
            // test to see that the result is correct
            Assert.IsTrue(OK);
        }
Esempio n. 25
0
        public void TestEndPointTownFound()
        {
            //create an instance of the class we want to create
            clsDestination AnDestination = new clsDestination();
            //Boolean variable to store the result of the validation
            Boolean Found = false;
            //boolean variable to record if data is OK (Assume that it is)
            Boolean OK = true;
            //create some test data to use with the method
            Int32 DestinationID = 131;

            //invoke the method
            Found = AnDestination.Find(DestinationID);
            //check the EndPointTown property
            if (AnDestination.EndPointTown != "Nwoott Town")
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
Esempio n. 26
0
        public void TestDropoffTimeFound()
        {
            //create an instance of the class we want to create
            clsDestination AnDestination = new clsDestination();
            //Boolean variable to store the result of the validation
            Boolean Found = false;
            //boolean variable to record if data is OK (assume that it is)
            Boolean OK = true;
            //create some test data to use with the method
            Int32 DestinationID = 131;

            //invoke the method
            Found = AnDestination.Find(DestinationID);
            //check the DropoffTime property
            if (AnDestination.DropoffTime != Convert.ToDateTime("23/03/2019 22:30:00"))
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
        public void ListAndCountOK()
        {
            // create an instance of the class we want to create
            clsDestinationCollection AllDestinations = new clsDestinationCollection();
            // create a list of test data
            List <clsDestination> TestList = new List <clsDestination>();
            // create the item of test data
            clsDestination TestItem = new clsDestination();

            // set its properties
            TestItem.DestinationID  = 1;
            TestItem.Destination    = "Rome";
            TestItem.PricePerPerson = 99;
            TestItem.DayOfFlight    = DateTime.Now.Date;
            TestItem.ReturnDate     = DateTime.Now.Date.AddDays(1);
            // add the item to the test list
            TestList.Add(TestItem);
            // assign the data to the property
            AllDestinations.DestinationList = TestList;
            // test to see that the two values are the same
            Assert.AreEqual(AllDestinations.Count, TestList.Count);
        }
Esempio n. 28
0
        public void UpdateMethodOK()
        {
            //create an instance of the class we want to creat
            clsDestinationCollection AllDestinations = new clsDestinationCollection();
            //create the item of test data
            clsDestination TestItem = new clsDestination();
            //var to store the primary key
            Int32 Primarykey = 0;

            //set its properties
            TestItem.EndPointHouseNo  = "1";
            TestItem.EndPointPostCode = "LE2 2WX";
            TestItem.EndPointStreet   = "God Street";
            TestItem.EndPointTown     = "Leicester";
            TestItem.PickupTime       = DateTime.Now.Date;
            TestItem.DropoffTime      = DateTime.Now.Date;
            //set ThisDestination to the test data
            AllDestinations.ThisDestination = TestItem;
            //add the record
            Primarykey = AllDestinations.Add();
            //set the primary key of the test data
            TestItem.DestinationID = Primarykey;
            //modify the test data
            TestItem.EndPointHouseNo  = "132";
            TestItem.EndPointPostCode = "GH2 2WX";
            TestItem.EndPointStreet   = "God's Son Street";
            TestItem.EndPointTown     = "Ash Town";
            TestItem.PickupTime       = DateTime.Now.Date;
            TestItem.DropoffTime      = DateTime.Now.Date;
            //set the record based on the new test data
            AllDestinations.ThisDestination = TestItem;
            //update the record
            AllDestinations.Update();
            //find the record
            AllDestinations.ThisDestination.Find(Primarykey);
            //test to see ThisDestionation match the test date
            Assert.AreEqual(AllDestinations.ThisDestination, TestItem);
        }