Esempio n. 1
0
        public void ValidMethodOK()
        {
            //create an instance of the class we want to create
            clsCar ACar = new clsCar();
            //string variable to store any error message
            String Error = "";

            //invoke th method
            Error = ACar.Valid(CarName, Model, BodyType, YearMade);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 2
0
        public void PriceMid()
        {
            //create an instance of the class we want to create
            clsCar AnPrice = new clsCar();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string Price = "2000"; //this should be ok

            //invoke the method
            Error = AnPrice.Valid(RegPlate, CarName, CarModel, CarColour, EngineSize, Price);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 3
0
        public void YearMadeInvalidDate()
        {
            //create an instance of the class we want to create
            clsCar ACar = new clsCar();
            //string vriable to store any error message
            String Error = "";
            //set YearMade to a non date value
            string YearMade = "this is not a date";

            //invoke the method
            Error = ACar.Valid(CarName, Model, BodyType, YearMade);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 4
0
        public void CarNameMaxPlusOne()
        {
            //create an instance of the class we want to create
            clsCar ACar = new clsCar();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string CarName = "aaaaaaaaaaa"; //this should fail

            //invoke the method
            Error = ACar.Valid(CarName, Model, BodyType, YearMade);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 5
0
        public void ModelMid()
        {
            //create an instance of the class we want to create
            clsCar ACar = new clsCar();
            //boolean variable to store the result of the validation
            Boolean OK = false;
            //create some test data to assign to the property
            string SomeModel = "abcdeabcdeabcdeabcdeabcde";

            //invoke the method
            OK = ACar.Valid(SomeModel);
            //test to see that the result
            Assert.IsTrue(OK);
        }
Esempio n. 6
0
        public void ValidExist()
        {
            //create an instance of the class we want to create
            clsCar ACar = new clsCar();
            //boolean variable to store the result of the validation
            Boolean OK = false;
            //create some test data to assign
            string SomeModel = "Ford";

            //invoke the method
            OK = ACar.Valid(SomeModel);
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
Esempio n. 7
0
        public void BodyTypeMid()
        {
            //create an instance of the class we want to create
            clsCar ACar = new clsCar();
            //string variable to store any error message
            String Error = "";
            //this should pass
            string BodyType = "";

            BodyType = BodyType.PadRight(10, 'a');
            //invoke the method
            Error = ACar.Valid(CarName, Model, BodyType, YearMade);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 8
0
        public void ModelMaxPlusOne()
        {
            //create an instance of the class we want to create
            clsCar ACar = new clsCar();
            //string variable to store any error message
            String Error = "";
            //this should fail
            string Model = "";

            Model = Model.PadRight(26, 'a');
            //invoke the method
            Error = ACar.Valid(CarName, Model, BodyType, YearMade);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 9
0
        public void EngineSizeExtremeMax()
        {
            //create an instance of the class we want to create
            clsCar AnEngineSize = new clsCar();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string EngineSize = "";

            //this should be ok
            EngineSize = EngineSize.PadRight(500, 'a');
            //invoke the method
            Error = AnEngineSize.Valid(RegPlate, CarName, CarModel, CarColour, EngineSize, Price);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 10
0
        public void ModelExtremeMax()
        {
            //create an instance of the class we want to create
            clsCar ACar = new clsCar();
            //boolean variable to store the result of the validation
            Boolean OK = false;
            //create some test data to assign to the property
            string SomeModel = "";

            //pad the string with 'a' charachter
            SomeModel = SomeModel.PadRight(500, 'a');
            //invoke the method
            OK = ACar.Valid(SomeModel);
            //test to see that the result is correct
            Assert.IsFalse(OK);
        }
Esempio n. 11
0
        public void YearMadeMin()
        {
            //create an instance of the class we want to create
            clsCar ACar = new clsCar();
            //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 YearMade = TestDate.ToString();

            //invoke the method
            Error = ACar.Valid(CarName, Model, BodyType, YearMade);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }