Exemplo n.º 1
0
        public void DeleteMethodOK()
        {
            //crate an instance of the class we want to create
            clsGamesCollection AllGames = new clsGamesCollection();
            //crate the item of test data
            clsGames TestItem = new clsGames();

            //var to store the primry key
            Int32 Primarykey = 0;

            //set its properties
            TestItem.Game_ID          = 1;
            TestItem.Game_Name        = "Areeb";
            TestItem.Game_Description = "This is my tes data";
            TestItem.Game_Quantity    = 25;
            TestItem.Platform         = "PlayStation";
            TestItem.Supplier_ID      = 21;
            //set this game to the test data
            AllGames.ThisGame = TestItem;
            //add the record
            Primarykey = AllGames.Add();
            // set the primary key of the test data
            TestItem.Game_ID = Primarykey;
            //find the record
            AllGames.ThisGame.Find(Primarykey);
            //delete the record
            AllGames.Delete();
            //now find the record
            Boolean Found = AllGames.ThisGame.Find(Primarykey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
Exemplo n.º 2
0
        public void ListAndCountOK()
        {
            //create an instance of the class we want to create
            clsGamesCollection AllGames = new clsGamesCollection();
            //create some test data to assign to the property
            //in this case the data needs to be list of objects.
            List <clsGames> TestList = new List <clsGames>();
            //add an item to the list
            //create the item of test data
            clsGames TestItem = new clsGames();

            //set its properties
            TestItem.Game_ID          = 1;
            TestItem.Game_Name        = "Areeb";
            TestItem.Game_Description = "This is my test description";
            TestItem.Game_Quantity    = 25;
            TestItem.Platform         = "Xbox";
            TestItem.Supplier_ID      = 21;
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AllGames.Gameslist = TestList;
            //test to see that the 2 values are the same
            Assert.AreEqual(AllGames.Count, TestList.Count);
        }
Exemplo n.º 3
0
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsGamesCollection AllGames = new clsGamesCollection();
            //create th eitme of test data
            clsGames TestItem = new clsGames();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.Game_ID          = 1;
            TestItem.Game_Name        = "Areeb";
            TestItem.Game_Description = "This is my test data";
            TestItem.Game_Quantity    = 31;
            TestItem.Platform         = "Nintendo switch";
            TestItem.Supplier_ID      = 11;
            //set this game to the test data
            AllGames.ThisGame = TestItem;
            //add the record
            PrimaryKey = AllGames.Add();
            //set the primary key of the tst data
            TestItem.Game_ID = PrimaryKey;
            //find the rocrd
            AllGames.ThisGame.Find(PrimaryKey);
            //test to see that the 2 values are the same
            Assert.AreEqual(AllGames.ThisGame, TestItem);
        }
Exemplo n.º 4
0
        public void InstanceOK()

        {
            //ceate an instanc eof the class we want to create
            clsGames AGame = new clsGames();

            Assert.IsNotNull(AGame);
        }
Exemplo n.º 5
0
        public void Game_QuantityPropertyOK()
        {
            clsGames AGame = new clsGames();
            //create some test data to assighn to the property
            Int32 TestData = 25;

            //assighn the data to the property
            AGame.Game_Quantity = TestData;
            Assert.AreEqual(AGame.Game_Quantity, TestData);
        }
Exemplo n.º 6
0
        public void PlatformPropertyOK()
        {
            clsGames AGame = new clsGames();
            //create some test data to assighn to the property
            string TestData = "Xbox";

            //assighn the data to the property
            AGame.Platform = TestData;
            Assert.AreEqual(AGame.Platform, TestData);
        }
Exemplo n.º 7
0
        public void Supplier_IDPropertyOK()
        {
            clsGames AGame = new clsGames();
            //create some test data to assighn to the property
            Int32 TestData = 21;

            //assighn the data to the property
            AGame.Supplier_ID = TestData;
            Assert.AreEqual(AGame.Supplier_ID, TestData);
        }
Exemplo n.º 8
0
        public void Game_DescriptionPropertyOK()
        {
            clsGames AGame = new clsGames();
            //create some test data to assighn to the property
            string TestData = "This is my Test data";

            //assighn the data to the property
            AGame.Game_Description = TestData;
            Assert.AreEqual(AGame.Game_Description, TestData);
        }
Exemplo n.º 9
0
        public void Game_NamePropertyOK()
        {
            clsGames AGame = new clsGames();
            //create some test data to assighn to the property
            string TestData = "Areeb";

            //assighn the data to the property
            AGame.Game_Name = TestData;
            Assert.AreEqual(AGame.Game_Name, TestData);
        }
Exemplo n.º 10
0
        public void ValidMethodOK()
        {
            //create an instanc eof the class we want to create
            clsGames AGame = new clsGames();
            //string variable to store any error message
            String Error = "";

            //invoke the method
            Error = AGame.Valid(Game_Name, Game_Description, Game_Quantity, Platform, Supplier_ID);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 11
0
        public void Game_NameMinPlusOne()
        {
            //cretae an instnac eof the class we want to create
            clsGames AGame = new clsGames();
            //boolean variable to store the result
            String Error = "";
            //create some test data to pass to the method
            string Game_Name = "aaa";//this should pass

            Error = AGame.Valid(this.Game_Name, Game_Description, Game_Quantity, Platform, Supplier_ID);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 12
0
        public void FindMethodOK()
        {
            //create an instance of the class
            clsGames AGame = new clsGames();
            //boolean variable to store the result of the VALIDATING
            Boolean Found = false;
            //create some test data to use with the method
            Int32 Game_ID = 1;

            //invoke the method
            Found = AGame.Find(Game_ID);
            //test to see that the result is correct
            Assert.IsTrue(Found);
        }
Exemplo n.º 13
0
        public void Supplier_IDMinplusOne()
        {
            //create an insatnce of the class we want to create
            clsGames AGame = new clsGames();
            //string variable to storee any error message
            String Error = "";
            //create some tst data to pass to the method
            String Supplier_ID = "aa";//this should work

            //invoke the method
            Error = AGame.Valid(Game_Name, Game_Description, Game_Quantity, Platform, Supplier_ID);
            //test to see hat the result is correct
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 14
0
        public void Game_NameMaxPlusOne()
        {
            //create an instance of the class you want to create
            clsGames AGame = new clsGames();
            //boolean variable to store the result of the validaiton
            String Error = "";
            //create some test data to pass to the method
            String Game_Name = "";

            Game_Name = Game_Name.PadRight(51, 'a');//this test should pass
            Error     = AGame.Valid(Game_Name, Game_Description, Game_Quantity, Platform, Supplier_ID);
            //tets to see the result is correct
            Assert.AreNotEqual(Error, "");
        }
Exemplo n.º 15
0
        public void PlatformMid()
        {
            //create an insatnce of the class we want to create
            clsGames AGame = new clsGames();
            //string variable to storee any error message
            String Error = "";
            //create some tst data to pass to the method
            String Platform = "";

            Platform = Platform.PadRight(50, 'a');    //this should trigger an error
            //invoke the method
            Error = AGame.Valid(Game_Name, Game_Description, Game_Quantity, Platform, Supplier_ID);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 16
0
        public void Game_NameExtremeMax()
        {
            //create an instance of the class we want to ceate
            clsGames AGame = new clsGames();
            //string variabe to tore any error message
            string Error = "";
            //create some test method to pass to the method
            string Game_Name = "";

            Game_Name = Game_Name.PadRight(500, 'a');
            //invoke the method
            Error = AGame.Valid(Game_Name, Game_Description, Game_Quantity, Platform, Supplier_ID);
            //test t see that the result is ok
            Assert.AreNotEqual(Error, "");
        }
Exemplo n.º 17
0
        public void ThisGamePropertyOK()
        {
            //create an instance of the class we want to create
            clsGamesCollection AllGames = new clsGamesCollection();
            //create some test data to assign to the property
            clsGames TestGame = new clsGames();

            //set the properties of the test object
            TestGame.Game_ID          = 1;
            TestGame.Game_Name        = "Areeb";
            TestGame.Game_Description = "This is my test data";
            TestGame.Game_Quantity    = 25;
            TestGame.Platform         = "Xbox";
            TestGame.Supplier_ID      = 21;
            //assign the data to the property
            AllGames.ThisGame = TestGame;
            //test to see that the values are equal
            Assert.AreEqual(AllGames.ThisGame, TestGame);
        }
Exemplo n.º 18
0
        public void TestPlatformFound()
        {
            //create an instance of the class we want to create
            clsGames AGame = new clsGames();
            //boolean variable to store result of the search
            Boolean Found = false;
            //boolean variable to record if data is okay
            Boolean OK = true;
            // create some test data to use with the method
            Int32 Game_ID = 1;

            //invoke the method
            Found = AGame.Find(Game_ID);
            //check the game ID
            if (AGame.Platform != "Xbox")
            {
                OK = false;
            }
            //test to see that the results is correct
            Assert.IsTrue(OK);
        }
Exemplo n.º 19
0
        public void UpdateMethodOK()
        {
            //create an instance of the class we want to create
            clsGamesCollection AllGames = new clsGamesCollection();
            //create the item of test data
            clsGames TestItem = new clsGames();
            //var to store the primry key
            Int32 Primarykey = 0;

            //set its properties
            TestItem.Game_ID          = 1;
            TestItem.Game_Name        = "Areeb";
            TestItem.Game_Description = "This is my tes data";
            TestItem.Game_Quantity    = 25;
            TestItem.Platform         = "PlayStation";
            TestItem.Supplier_ID      = 21;
            //set this game to the test data
            AllGames.ThisGame = TestItem;
            //add the record
            Primarykey = AllGames.Add();
            // set the primary key of the test data
            TestItem.Game_ID = Primarykey;
            //modify the test data
            TestItem.Game_ID          = 2;
            TestItem.Game_Name        = "Beera";
            TestItem.Game_Description = "This is'nt my test data";
            TestItem.Game_Quantity    = 26;
            TestItem.Platform         = "PlayStation4";
            TestItem.Supplier_ID      = 22;
            //set the record based on the neew test data
            AllGames.ThisGame = TestItem;
            //update the record
            AllGames.Update();
            //find the record
            AllGames.ThisGame.Find(Primarykey);
            // test to see this game matches the test data
            Assert.AreEqual(AllGames.ThisGame, TestItem);
        }