Пример #1
0
        public void ListAndCountOK()
        {
            clsTariffCollection AllTariffs = new clsTariffCollection();
            //create some test data to assign to the property
            //in this case the data needs to be a list of objects
            List <clsTariff> TestList = new List <clsTariff>();
            //add an item to the list
            //create the item of test data
            clsTariff TestItem = new clsTariff();

            //set its properties
            TestItem.TariffID      = 1;
            TestItem.TariffTexts   = "500";
            TestItem.TariffCalls   = "Unlimited";
            TestItem.TariffData    = "20GB";
            TestItem.TariffNetwork = "O2";
            TestItem.TariffPrice   = 30.00m;
            TestItem.TariffUpfront = 50.00m;
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AllTariffs.TariffList = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(AllTariffs.Count, TestList.Count);
        }
Пример #2
0
        public void AddMethodOK()
        {
            clsTariffCollection AllTariffs = new clsTariffCollection();
            //create the item of test data
            clsTariff TestItem = new clsTariff();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.TariffID      = 1;
            TestItem.TariffTexts   = "100";
            TestItem.TariffCalls   = "Unlimited";
            TestItem.TariffData    = "50GB";
            TestItem.TariffNetwork = "EE";
            TestItem.TariffPrice   = 50.00m;
            TestItem.TariffUpfront = 70.00m;
            //set thisTariff to the test data
            AllTariffs.ThisTariff = TestItem;
            //add the record
            PrimaryKey = AllTariffs.Add();
            //set the primary key of the test data
            TestItem.TariffID = PrimaryKey;
            //find the record
            AllTariffs.ThisTariff.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllTariffs.ThisTariff, TestItem);
        }
Пример #3
0
        public void TariffInstanceOK()
        {
            //create an instance of the class
            clsTariff ATariff = new clsTariff();

            //test to see that it exists
            Assert.IsNotNull(ATariff);
        }
Пример #4
0
        public void FindMethodOK()
        {
            //create an instance of the class
            clsTariff ATariff  = new clsTariff();
            Boolean   Found    = false;
            Int32     TariffID = 1;

            Found = ATariff.Find(TariffID);
            Assert.IsTrue(Found);
        }
Пример #5
0
        public void TariffTextsOK()
        {
            //create an instance of the class
            clsTariff ATariff = new clsTariff();
            //create some test data
            string tariffTexts = "Unlimited";

            //assign the data to property
            ATariff.TariffTexts = tariffTexts;
            //test to see that the two values are the same
            Assert.AreEqual(ATariff.TariffTexts, tariffTexts);
        }
Пример #6
0
        public void TariffPriceOK()
        {
            //create an instance of the class
            clsTariff ATariff = new clsTariff();
            //create some test data
            decimal tariffPrice = 45.00m;

            //assign the data to property
            ATariff.TariffPrice = tariffPrice;
            //test to see that the two values are the same
            Assert.AreEqual(ATariff.TariffPrice, tariffPrice);
        }
Пример #7
0
        public void TariffNetworkOK()
        {
            //create an instance of the class
            clsTariff ATariff = new clsTariff();
            //create some test data
            string tariffNetwork = "O2";

            //assign the data to property
            ATariff.TariffNetwork = tariffNetwork;
            //test to see that the two values are the same
            Assert.AreEqual(ATariff.TariffNetwork, tariffNetwork);
        }
Пример #8
0
        public void TariffIDOK()
        {
            //create an instance of the class
            clsTariff ATariff = new clsTariff();
            //create some test data
            Int32 TariffID = 1;

            //assign the data to property
            ATariff.TariffID = TariffID;
            //test to see that the two values are the same
            Assert.AreEqual(ATariff.TariffID, TariffID);
        }
Пример #9
0
        public void TariffDataOK()
        {
            //create an instance of the class
            clsTariff ATariff = new clsTariff();
            //create some test data
            string dataLimit = "20GB";

            //assign the data to property
            ATariff.TariffData = dataLimit;
            //test to see that the two values are the same
            Assert.AreEqual(ATariff.TariffData, dataLimit);
        }
Пример #10
0
        public void TariffCallsOK()
        {
            //create an instance of the class
            clsTariff ATariff = new clsTariff();
            //create some test data
            string callLimit = "Unlimited";

            //assign the data to property
            ATariff.TariffCalls = callLimit;
            //test to see that the two values are the same
            Assert.AreEqual(ATariff.TariffCalls, callLimit);
        }
Пример #11
0
        public void TariffUpfrontBadData()
        {
            //create an instance of the class
            clsTariff ATariff = new clsTariff();
            //create a string variable to store the result of the varibale
            String Error = "";
            //create some test data to test the method
            string SomeTariffUpfront = "xyz";

            //invoke the mothod
            Error = ATariff.ValidTariffPrice(SomeTariffUpfront);
            //test to see that the result is NOT OK i.e there should be an error message
            Assert.AreNotEqual(Error, "");
        }
Пример #12
0
        public void TariffTextsMidOK()
        {
            //create an instance of the class
            clsTariff ATariff = new clsTariff();
            //create a string variable to store the result of the varibale
            String Error = "";
            //create some test data to test the method
            string SomeTariffTexts = "Unlimited Texts ";

            //invoke the mothod
            Error = ATariff.ValidTariffTexts(SomeTariffTexts);
            //test to see that the result is NOT OK i.e there should be an error message
            Assert.AreEqual(Error, "");
        }
Пример #13
0
        public void TariffNetworkExtremeMaxOK()
        {
            //create an instance of the class
            clsTariff ATariff = new clsTariff();
            //create a string variable to store the result of the varibale
            String Error = "";
            //create some test data to test the method
            string SomeTariffNetwork = "O2222222222222222222222222222222222222222222222222";

            //invoke the mothod
            Error = ATariff.ValidTariffNetwork(SomeTariffNetwork);
            //test to see that the result is NOT OK i.e there should be an error message
            Assert.AreNotEqual(Error, "");
        }
Пример #14
0
        public void TestTariffNotFound()
        {
            //create an instance of the class
            clsTariff ATariff  = new clsTariff();
            Boolean   Found    = false;
            Boolean   OK       = true;
            Int32     TariffID = 21;

            Found = ATariff.Find(TariffID);
            if (ATariff.TariffID != 21)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
Пример #15
0
        public void ThisTariffPropertyOK()
        {
            //create an instance of the class
            clsTariffCollection AllTariffs = new clsTariffCollection();
            //create some test data to assign to the property
            clsTariff TestTariff = new clsTariff();

            //set the properties of the test object
            TestTariff.TariffID      = 1;
            TestTariff.TariffTexts   = "2000";
            TestTariff.TariffCalls   = "Unlimited";
            TestTariff.TariffData    = "50GB";
            TestTariff.TariffNetwork = "Vodafone";
            TestTariff.TariffPrice   = 15.99m;
            TestTariff.TariffUpfront = 10.00m;
            //assign the data to the property
            AllTariffs.ThisTariff = TestTariff;
            //test to see that the two values are the same
            Assert.AreEqual(AllTariffs.ThisTariff, TestTariff);
        }