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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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, ""); }
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); }
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, ""); }
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); }
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); }
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, ""); }
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); }