Example #1
0
        public void ListAndCountOK()
        {
            //create an instance of the class we want to create
            clsRoomtypeCollection AllRooms = new clsRoomtypeCollection();
            //create some test data to assign to the property
            //in this case the data needs to be a list of objects
            List <clsRoomType> TestList = new List <clsRoomType>();
            //add an item to tge list
            //create the item of test data
            clsRoomType TestItem = new clsRoomType();

            //set its properties
            TestItem.Active       = true;
            TestItem.RoomtypeID   = 81;
            TestItem.RoomFloorNo  = 1;
            TestItem.RoomtypeSize = "4 Guests";
            TestItem.Roomtype     = "Standard";
            TestItem.DateTime     = DateTime.Now.Date;
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AllRooms.RoomtypeList = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(AllRooms.Count, TestList.Count);
        }
Example #2
0
        public void DeleteMethodOK()
        {
            //Create an isntance of the class we want to create
            clsRoomtypeCollection AllRooms = new clsRoomtypeCollection();
            //create the item of test data
            clsRoomType TestItem = new clsRoomType();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its proeprties
            TestItem.Active       = false;
            TestItem.RoomtypeID   = 81;
            TestItem.RoomFloorNo  = 1;
            TestItem.RoomtypeSize = "4 guests";
            TestItem.Roomtype     = "Standard";
            TestItem.DateTime     = DateTime.Now.Date;
            //set ThisRoomtype to the test dat
            AllRooms.ThisRoomtype = TestItem;
            //add the record
            PrimaryKey = AllRooms.Add();
            //set the primary key of the tst data
            TestItem.RoomtypeID = PrimaryKey;
            //find the record
            AllRooms.ThisRoomtype.Find(PrimaryKey);
            //delete the record
            AllRooms.Delete();
            //now find the record
            Boolean Found = AllRooms.ThisRoomtype.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
Example #3
0
        public void AddMethodOK()
        {
            //create instance of the class we want to create
            clsRoomtypeCollection AllRooms = new clsRoomtypeCollection();
            //createthe item of the test data
            clsRoomType TestItem = new clsRoomType();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.Active       = true;
            TestItem.RoomFloorNo  = 1;
            TestItem.RoomtypeSize = "4 guests";
            TestItem.Roomtype     = "Standard";
            TestItem.DateTime     = DateTime.Now.Date;
            //Set ThisRoom to test the data
            AllRooms.ThisRoomtype = TestItem;
            //add the record
            PrimaryKey = AllRooms.Add();
            //set the primary key of the test data
            TestItem.RoomtypeID = PrimaryKey;//find the record
            //find the record
            AllRooms.ThisRoomtype.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllRooms.ThisRoomtype, TestItem);
        }
Example #4
0
        public void InstanceOk()
        {
            //create an instance of the class we want to create
            clsRoomType ARoomType = new clsRoomType();

            //test to see that it exists
            Assert.IsNotNull(ARoomType);
        }
Example #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //create a new instance of clsRoomtype
        clsRoomType ARoomType = new clsRoomType();

        //get the data from the session object
        ARoomType = (clsRoomType)Session["ARoomType"];
        //display the RoomID for this entry
        Response.Write(ARoomType);
    }
Example #6
0
        public void DataAddedPropertyOK()
        {
            clsRoomType AnRoomType = new clsRoomType();
            //create some test data to assign to the property
            DateTime TestData = DateTime.Now.Date;

            //assign the data to the property
            AnRoomType.DateTime = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnRoomType.DateTime, TestData);
        }
Example #7
0
        public void RoomtypePropertyOK()
        {
            clsRoomType AnRoomtype = new clsRoomType();
            //create some test data to assign to the property
            String TestData = "Standard";

            //assign the data to the property
            AnRoomtype.Roomtype = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnRoomtype.Roomtype, TestData);
        }
Example #8
0
        public void RoomtypeFloorNoPropertyOK()
        {
            clsRoomType AnFloorNo = new clsRoomType();
            //create some test data to assign to the property
            Int32 TestData = 1;

            //assign the data to the property
            AnFloorNo.RoomFloorNo = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnFloorNo.RoomFloorNo, TestData);
        }
Example #9
0
        public void ValidMethodOK()
        {
            //create an instance of the class we want to create
            clsRoomType ARoomtype = new clsRoomType();
            //string variable to store the error message
            String Error = "";

            //invoke method
            Error = ARoomtype.Valid(RoomtypeFloorNo, RoomtypeSize, Roomtype, Datetime);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Example #10
0
        public void FindMethodOK()
        {
            //create an instance of the class we want to create
            clsRoomType ARoomtype = new clsRoomType();
            //boolean variable to store the result of the validation
            Boolean Found = false;
            //create some test data to use with the method
            Int32 RoomtypeID = 81;

            //invoke method
            Found = ARoomtype.Find(RoomtypeID);
            //test to see that the result is correct
            Assert.IsTrue(Found);
        }
Example #11
0
        public void RoomtypeMid()
        {
            //create an instance of the class we want to create
            clsRoomType ARoomtype = new clsRoomType();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string Roomtype = "aaa";

            //invoke the method
            Error = ARoomtype.Valid(RoomtypeFloorNo, RoomtypeSize, Roomtype, Datetime);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Example #12
0
        public void ThisRoomtypePropertyOK()
        {
            //create an instance of the class we want to create
            clsRoomtypeCollection AllRooms = new clsRoomtypeCollection();
            //vreate some test dat to assign to the property
            clsRoomType TestRooms = new clsRoomType();

            //set the properties of the test opbject
            TestRooms.Active       = true;
            TestRooms.RoomtypeID   = 81;
            TestRooms.RoomFloorNo  = 1;
            TestRooms.RoomtypeSize = "4 Guests";
            TestRooms.Roomtype     = "Standard";
            TestRooms.DateTime     = DateTime.Now.Date;
            //assign the data to the property
            AllRooms.ThisRoomtype = TestRooms;
            //test to see if the two values are the same
            Assert.AreEqual(AllRooms.ThisRoomtype, TestRooms);
        }
Example #13
0
        public void TestDateAddedFound()
        {
            //create an instance of the class we want to create
            clsRoomType ARoomtype = new clsRoomType();
            //boolean variable to store the result of the validation
            Boolean Found = false;
            //boolean variable to record if data is OK (assume it is)
            Boolean OK = true;
            //create some test data to use with the method
            Int32 RoomtypeID = 81;

            //invoke method
            Found = ARoomtype.Find(RoomtypeID);
            //check the RoomypeID
            if (ARoomtype.DateTime != Convert.ToDateTime("12/03/2020"))
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
Example #14
0
        public void DateTimeExtremeMin()
        {
            //create an instance of the class we want to create
            clsRoomType ARoomtype = new clsRoomType();
            //string variable to store any error message
            String Error = "";
            //create variable to store test data
            DateTime TestDate;

            //set the data to todays date
            TestDate = DateTime.Now.Date;
            //change the date to whatver is the date ess 100 years
            TestDate = TestDate.AddYears(-100);
            //convert the data variable to a string variable
            string Datetime = TestDate.ToString();

            //invoke the method
            Error = ARoomtype.Valid(RoomtypeFloorNo, RoomtypeSize, Roomtype, Datetime);
            //
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Example #15
0
        public void UpdateMethodOK()
        {
            //Create an isntance of the class we want to create
            clsRoomtypeCollection AllRooms = new clsRoomtypeCollection();
            //create the item of test data
            clsRoomType TestItem = new clsRoomType();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its proeprties
            TestItem.Active       = false;
            TestItem.RoomFloorNo  = 1;
            TestItem.RoomtypeSize = "4 guests";
            TestItem.Roomtype     = "Standard";
            TestItem.DateTime     = DateTime.Now.Date;
            //set ThisRoomtype to the test dat
            AllRooms.ThisRoomtype = TestItem;
            //add the record
            PrimaryKey = AllRooms.Add();
            //set the primary key of the tst data
            TestItem.RoomtypeID = PrimaryKey;
            //modify the test data
            TestItem.Active       = false;
            TestItem.RoomFloorNo  = 1;
            TestItem.RoomtypeSize = "4 guests";
            TestItem.Roomtype     = "Standard";
            TestItem.DateTime     = DateTime.Now.Date;
            //set the record based on the new test data
            AllRooms.ThisRoomtype = TestItem;
            //update the record
            AllRooms.Update();
            //find the record
            AllRooms.ThisRoomtype.Find(PrimaryKey);
            //test to see Thisroomtype matches the test data
            Assert.AreEqual(AllRooms.ThisRoomtype, TestItem);
        }