public void DeleteMethodOK() { //Create an instance of the class clsCarRepairsCollection AllCarRepairs = new clsCarRepairsCollection(); //create the item of test data clsCarRepairs TestItem = new clsCarRepairs(); //Var to store the primary key Int32 PrimaryKey = 0; //Set its properties TestItem.CarRepairID = 8; TestItem.DaysInForRepair = 1; TestItem.DeadlineDate = DateTime.Now.Date.AddDays(9); TestItem.PartPrice = 200.00m; TestItem.PartRequired = "4 new tyres"; //set this repair to the test data AllCarRepairs.ThisCarRepair = TestItem; //add the record PrimaryKey = AllCarRepairs.Add(); //set the primary key of the test data TestItem.CarRepairID = PrimaryKey; //find the record AllCarRepairs.ThisCarRepair.Find(PrimaryKey); //Delete the record AllCarRepairs.Archive(); //Now find the record Boolean Found = AllCarRepairs.ThisCarRepair.Find(PrimaryKey); //Test to see if the two values are the same Assert.IsFalse(Found); }
public void AddMethodOK() { //Create an instance of the class clsCarRepairsCollection AllCarRepairs = new clsCarRepairsCollection(); //create the item of test data clsCarRepairs TestItem = new clsCarRepairs(); //Var to store the primary key Int32 PrimaryKey = 0; //Set its properties TestItem.CarRepairID = 2000; TestItem.DaysInForRepair = 27; TestItem.DeadlineDate = DateTime.Now.Date.AddDays(60); TestItem.PartPrice = 52.99m; TestItem.PartRequired = "Add test"; TestItem.CarID = 2000; TestItem.StaffID = 2000; //set this repair to the test data AllCarRepairs.ThisCarRepair = TestItem; //add the record PrimaryKey = AllCarRepairs.Add(); //set the primary key of the test data TestItem.CarRepairID = PrimaryKey; //find the record AllCarRepairs.ThisCarRepair.Find(PrimaryKey); //Test to see if the two values are the same Assert.AreEqual(AllCarRepairs.ThisCarRepair, TestItem); }
public void CarRepairListOK() { //Create an instance of the class clsCarRepairsCollection AllCarRepairs = new clsCarRepairsCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <clsCarRepairs> TestList = new List <clsCarRepairs>(); //Add an item to the list //create the item of test data clsCarRepairs TestItem = new clsCarRepairs(); //Set its properties TestItem.CarRepairID = 1; TestItem.DaysInForRepair = 30; TestItem.DeadlineDate = DateTime.Now.Date; TestItem.PartPrice = 99.99m; TestItem.PartRequired = "Test part"; //Add the item to the list TestList.Add(TestItem); //Assign the data to the property AllCarRepairs.CarRepairList = TestList; //Test to see if the two values are the same Assert.AreEqual(AllCarRepairs.CarRepairList, TestList); }
public void InstanceOK() { //create instance clsCarRepairs AnCarRepair = new clsCarRepairs(); //test to see that it exists Assert.IsNotNull(AnCarRepair); }
public void PartRequiredOK() { //create instance clsCarRepairs AnCarRepair = new clsCarRepairs(); //create some test data string TestData = "Engine"; //assign data to the property AnCarRepair.PartRequired = TestData; //test to see two values are the same Assert.AreEqual(AnCarRepair.PartRequired, TestData); }
public void PartPriceOK() { //create instance clsCarRepairs AnCarRepair = new clsCarRepairs(); //create some test data decimal TestData = 1699.99m; //assign data to the property AnCarRepair.PartPrice = TestData; //test to see two values are the same Assert.AreEqual(AnCarRepair.PartPrice, TestData); }
public void DeadlineDateOK() { //create instance clsCarRepairs AnCarRepair = new clsCarRepairs(); //create some test data DateTime TestData = DateTime.Now.Date; //assign data to the property AnCarRepair.DeadlineDate = TestData; //test to see two values are the same Assert.AreEqual(AnCarRepair.DeadlineDate, TestData); }
public void DaysInForRepairOK() { //create instance clsCarRepairs AnCarRepair = new clsCarRepairs(); //create some test data Int32 TestData = 32; //assign data to the property AnCarRepair.DaysInForRepair = TestData; //test to see two values are the same Assert.AreEqual(AnCarRepair.DaysInForRepair, TestData); }
public void CarRepairFindMethodOK() { //create instance clsCarRepairs AnCarRepair = new clsCarRepairs(); //Create a boolean variable to store the result of validation. Boolean Found = false; //Create some test data to use with the method. Int32 CarRepairID = 1028; //Invoke the method. Found = AnCarRepair.Find(CarRepairID); //Test to see that the result is correct. Assert.IsTrue(Found); }
public void ThisCarRepairPropertyOK() { //Create an instance of the class clsCarRepairsCollection AllCarRepairs = new clsCarRepairsCollection(); //create tsome test data to assign to the property clsCarRepairs TestCarRepair = new clsCarRepairs(); //Set the properties of the test object TestCarRepair.CarRepairID = 1; TestCarRepair.DaysInForRepair = 30; TestCarRepair.DeadlineDate = DateTime.Now.Date; TestCarRepair.PartPrice = 99.99m; TestCarRepair.PartRequired = "Test part"; //Assign the data to the property AllCarRepairs.ThisCarRepair = TestCarRepair; //Test to see if the two values are the same Assert.AreEqual(AllCarRepairs.ThisCarRepair, TestCarRepair); }
public void PartRequiredMinPlusOne() { //create instance clsCarRepairs AnCarRepair = new clsCarRepairs(); //boolean variable to store the result of search Boolean OK = false; //Create some test data to use with the method. string DaysInForRepair = "30"; string DeadlineDate = DateTime.Now.Date.ToString(); string PartPrice = "12.99"; string PartRequired = "AA"; string CarID = "1023"; string StaffID = "1"; //Invoke the method OK = AnCarRepair.Valid(DaysInForRepair, DeadlineDate, PartPrice, PartRequired, CarID, StaffID); //Test to see that the result is correct. Assert.IsTrue(OK); }
public void DeadlineDateInvalidData() { //create instance clsCarRepairs AnCarRepair = new clsCarRepairs(); //boolean variable to store the result of search Boolean OK = false; //Create some test data to use with the method. string DaysInForRepair = "10"; string PartPrice = "12.99"; string PartRequired = "Some part"; string CarID = "1023"; string StaffID = "1"; //Enter type that is not a date string DeadlineDate = "Invalid data"; //Invoke the method OK = AnCarRepair.Valid(DaysInForRepair, DeadlineDate, PartPrice, PartRequired, CarID, StaffID); //Test to see that the result is correct. Assert.IsFalse(OK); }
public void TestPartRequiredFound() { //create instance clsCarRepairs AnCarRepair = new clsCarRepairs(); //boolean variable to store the result of search Boolean Found = false; //boolean variable to record if data is okay (assume it is). Boolean OK = true; //Create some test data to use with the method. Int32 CarRepairID = 1028; //Invoke the method. Found = AnCarRepair.Find(CarRepairID); //Check the PartRequired if (AnCarRepair.PartRequired != "Test Part") { OK = false; } //test to see if the result is correct. Assert.IsTrue(OK); }
public void TestDeadlineDateFound() { //create instance clsCarRepairs AnCarRepair = new clsCarRepairs(); //boolean variable to store the result of search Boolean Found = false; //boolean variable to record if data is okay (assume it is). Boolean OK = true; //Create some test data to use with the method. Int32 CarRepairID = 1028; //Invoke the method. Found = AnCarRepair.Find(CarRepairID); //Check the DeadlineDate if (AnCarRepair.DeadlineDate != Convert.ToDateTime("05/05/2017")) { OK = false; } //test to see if the result is correct. Assert.IsTrue(OK); }
public void UpdateMethodOK() { //Create an instance of the class clsCarRepairsCollection AllCarRepairs = new clsCarRepairsCollection(); //create the item of test data clsCarRepairs TestItem = new clsCarRepairs(); //Var to store the primary key Int32 PrimaryKey = 0; //Set its properties TestItem.DaysInForRepair = 1; TestItem.DeadlineDate = DateTime.Now.Date.AddDays(9); TestItem.PartPrice = 200.00m; TestItem.PartRequired = "4 new tyres"; //set this repair to the test data AllCarRepairs.ThisCarRepair = TestItem; //add the record PrimaryKey = AllCarRepairs.Add(); //set the primary key of the test data TestItem.CarRepairID = PrimaryKey; //Modify the data TestItem.DaysInForRepair = 2; TestItem.DeadlineDate = DateTime.Now.Date.AddDays(12); TestItem.PartPrice = 210.00m; TestItem.PartRequired = "7 new tyres"; //set this repair to the new test data AllCarRepairs.ThisCarRepair = TestItem; //Update the record AllCarRepairs.Update(); //find the record AllCarRepairs.ThisCarRepair.Find(PrimaryKey); //Test to see if the two values are the same Assert.AreEqual(AllCarRepairs.ThisCarRepair, TestItem); }