コード例 #1
0
ファイル: tstCar.cs プロジェクト: JanaliFaquir/ProjectWork
        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, "");
        }
コード例 #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, "");
        }
コード例 #3
0
ファイル: tstCar.cs プロジェクト: JanaliFaquir/ProjectWork
        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, "");
        }
コード例 #4
0
ファイル: tstCar.cs プロジェクト: JanaliFaquir/ProjectWork
        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, "");
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #7
0
ファイル: tstCar.cs プロジェクト: JanaliFaquir/ProjectWork
        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, "");
        }
コード例 #8
0
ファイル: tstCar.cs プロジェクト: JanaliFaquir/ProjectWork
        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, "");
        }
コード例 #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, "");
        }
コード例 #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);
        }
コード例 #11
0
ファイル: tstCar.cs プロジェクト: JanaliFaquir/ProjectWork
        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, "");
        }