예제 #1
0
        //used to test the valid method of the class
        public void ValidMethod()
        {
            //create an instance of a class
            clsLocation ALocation = new clsLocation();
            //create a string variable to store the result of the validation
            string Error = "";

            //create some test data to test the method
            Error = ALocation.Valid(SomeCountryDeparture, SomeCountryDestination, SomeAirportDeparture, SomeAirportDestination);
            //test to see the result is ok. i.e there was no error mssage returned
            Assert.AreEqual(Error, "");
        }
예제 #2
0
        public void AirportDestinationMaxPlusOne()
        {
            //create an instance of a class
            clsLocation ALocation = new clsLocation();
            //create a string variable to store the result of the validation
            string Error = "";
            //create some test data to test the method
            string SomeAirportDestination = "abcndefghijklmnopqrstuvwyzabcdefgdsasdfgh";

            //invoke the method
            Error = ALocation.Valid(SomeCountryDeparture, SomeCountryDestination, SomeAirportDeparture, SomeAirportDestination);
            //Test to see that the result is not ok. i.e there should be an error message
            Assert.AreNotEqual(Error, "");
        }
예제 #3
0
        public void CountryDepartureMinLessOne()
        {
            //create an instance of a class
            clsLocation ALocation = new clsLocation();
            //create a string variable to store the result of the validation
            string Error = "";
            //create some test data to test the method
            string SomeCountryDeparture = "Alban";

            //invoke the method
            Error = ALocation.Valid(SomeCountryDeparture, SomeCountryDestination, SomeAirportDeparture, SomeAirportDestination);
            //Test to see that the result is not ok. i.e there should be an error message
            Assert.AreNotEqual(Error, "");
        }
예제 #4
0
        public void AirportDestinationExtremeMax()
        {
            //create an instance of a class
            clsLocation ALocation = new clsLocation();
            //create a string variable to store the result of the validation
            string Error = "";
            //create some test data to test the method
            string SomeAirportDestination = "";

            //pad the string with characters
            SomeAirportDestination = SomeAirportDestination.PadRight(60, 'a');
            //invoke the method
            Error = ALocation.Valid(SomeCountryDeparture, SomeCountryDestination, SomeAirportDeparture, SomeAirportDestination);
            //Test to see that the result is not ok. i.e there should be an error message
            Assert.AreNotEqual(Error, "");
        }