Ejemplo n.º 1
0
        public void InstanceOK()
        {
            //create an instance of the class we want to create
            clsTown ATown = new clsTown();

            //Test to see it exists
            Assert.IsNotNull(ATown);
        }
Ejemplo n.º 2
0
        public void TownPropertyOK()
        {
            //create an instance of the class we want to create
            clsTown ATown = new clsTown();
            //create some test data to assign the property
            string SomeTown = "Leicester";

            //assign the data of the property
            ATown.Town = SomeTown;
            //test to see the two values are the same
            Assert.AreEqual(ATown.Town, SomeTown);
        }
Ejemplo n.º 3
0
        public void ValidMethodOK()
        {
            //create an instance of the class we want to create
            clsTown ATown = new clsTown();
            //string variable to store any error message
            String Error    = "";
            string SomeTown = "Leicester";

            //assign the data of the property
            Error = ATown.Valid(SomeTown);
            //test to see the results are ok
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 4
0
        public void TownMinPlusOne()
        {
            //create an instance of the class we want to create
            clsTown ATown = new clsTown();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass the method
            string SomeTown = "aa";

            //Invoke the method
            Error = ATown.Valid(SomeTown);
            //test to see the result is correct
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 5
0
        public void TownExtremeMax()
        {
            //create an instance of the class we want to create
            clsTown ATown = new clsTown();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass the method
            string SomeTown = "";

            SomeTown = SomeTown.PadRight(500, 'a');
            Error    = ATown.Valid(SomeTown);
            //test to see the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 6
0
        public void TownMaxLessOne()
        {
            //create an instance of the class we want to create
            clsTown ATown = new clsTown();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass the method
            string SomeTown = "";

            //pad the string with characters
            SomeTown = SomeTown.PadRight(49, 'a');
            //Invoke the method
            Error = ATown.Valid(SomeTown);
            //test to see the result is correct
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 7
0
        public void CountMatchesList()
        {
            //create an instance of our class clsCustomer
            clsTownCollection Towns = new clsTownCollection();
            //create some test data to assign the property
            //in this case the data needs to be a list of objects
            List <clsTown> TestList = new List <clsTown>();
            //add an item to the lsit
            //create the item of test data
            clsTown TestItem = new clsTown();

            //set its propeties
            TestItem.TownNo = 1;
            TestItem.Town   = "Leicester";
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            Towns.AllTowns = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(Towns.AllTowns, TestList);
        }