public void InstanceOK() { //create instance of class that is to be created clsServiceOrder AnOrder = new clsServiceOrder(); //test to see that class exists Assert.IsNotNull(AnOrder); }
public void OrderNoOK() { //create instance of class clsServiceOrder AnOrder = new clsServiceOrder(); //create some test data to assign to property Int32 OrderNo = 120; //assign data to property AnOrder.OrderNo = OrderNo; //test to see if both values are the same Assert.AreEqual(AnOrder.OrderNo, OrderNo); }
public void ServicePropertyOK() { //creat instance of the class clsServiceOrder AnOrder = new clsServiceOrder(); //create test data to assign to the property string SomeService = "CPU Repair"; //assign the data to the property AnOrder.Service = SomeService; //test to see if both values are the same Assert.AreEqual(AnOrder.Service, SomeService); }
public void ValidMethodOK() { //create insatance of class clsServiceOrder AnOrder = new clsServiceOrder(); //boolean value to store result of validation., which is intitialised to false Boolean OK = false; //create some test data to assign to property string SomeService = "CPU Repair"; //invoke the methoid OK = AnOrder.Valid(SomeService); //test to see if result is ok Assert.IsTrue(OK); }
public void AllOrdersOK() { //create instance of class we want to create clsServiceOrderCollection Orders = new clsServiceOrderCollection(); //create some test data to assign to property //the data needs to be a list of objects in this case List<clsServiceOrder> TestList = new List<clsServiceOrder>(); //add an item to the list //create item of test data clsServiceOrder TestItem = new clsServiceOrder(); //set its properties TestItem.OrderNo = 0; TestItem.Service = "Antivirus"; //add item to the test list TestList.Add(TestItem); //assign data to the property Orders.AllOrders = TestList; //test to see that the two values are the same Assert.AreEqual(Orders.AllOrders, TestList); }
//public constructor for the class //this constructor is a function that runs when class is created public clsServiceOrderCollection() { //create instance of data connection class clsDataConnection DB = new clsDataConnection(); //execute stored procedure to get list of data DB.Execute("sproc_tblServiceOrder_SelectAll"); //get count of records Int32 RecordCount = DB.Count; //Set up index for the loop Int32 Index = 0; //while there are records to process while (Index < RecordCount) { //create instance of Service Order class clsServiceOrder AnOrder = new clsServiceOrder(); //get service AnOrder.Service = DB.DataTable.Rows[Index]["Service"].ToString(); //get primary key AnOrder.OrderNo = Convert.ToInt32(DB.DataTable.Rows[Index]["OrderNo"]); //increment the index Index++; /* //create instance of order class to store an order * clsServiceOrder AnOrder = new clsServiceOrder(); * //set service to 'Antivirus' * AnOrder.Service = "Antivirus"; * //add the order to the private list of orders * allOrders.Add(AnOrder); * //re-initialise the AnOrder object to accept a new item * AnOrder = new clsServiceOrder(); * //set the new service to 'Memory' * AnOrder.Service = "Memory"; * //add second service to private list of orders * allOrders.Add(AnOrder); * //the private list now contains two orders*/ } }
//public constructor for the class //this constructor is a function that runs when class is created public clsServiceOrderCollection() { //create instance of data connection class clsDataConnection DB = new clsDataConnection(); //execute stored procedure to get list of data DB.Execute("sproc_tblServiceOrder_SelectAll"); //get count of records Int32 RecordCount = DB.Count; //Set up index for the loop Int32 Index = 0; //while there are records to process while (Index < RecordCount) { //create instance of Service Order class clsServiceOrder AnOrder = new clsServiceOrder(); //get service AnOrder.Service = DB.DataTable.Rows[Index]["Service"].ToString(); //get primary key AnOrder.OrderNo = Convert.ToInt32(DB.DataTable.Rows[Index]["OrderNo"]); //increment the index Index++; /* //create instance of order class to store an order clsServiceOrder AnOrder = new clsServiceOrder(); //set service to 'Antivirus' AnOrder.Service = "Antivirus"; //add the order to the private list of orders allOrders.Add(AnOrder); //re-initialise the AnOrder object to accept a new item AnOrder = new clsServiceOrder(); //set the new service to 'Memory' AnOrder.Service = "Memory"; //add second service to private list of orders allOrders.Add(AnOrder); //the private list now contains two orders*/ } }
public void TestOrderDateFound() { //create insatnce of class we want to creaste clsServiceOrder AnOrder = new clsServiceOrder(); //boolean var to store search reuslt Boolean Found = false; //Boolean var to check if data is ok Boolean OK = true; //craete test data to use with method Int32 OrderNo = 21; //invoke method Found = AnOrder.Find(OrderNo); //check property if (AnOrder.OrderDate != Convert.ToDateTime("13/03/2016")) { OK = false; } //test to see that result is correct Assert.IsFalse(OK); }
public void TestOrderNoFound() { //create instance of class we want to create clsServiceOrder AnOrder = new clsServiceOrder(); //boolean variable to store result of search Boolean Found = false; //bolean var to record if data is ok (assume it is) Boolean OK = true; //create some test data to use with the method Int32 OrderNo = 21; //invoke the method Found = AnOrder.Find(OrderNo); //check the address no if (AnOrder.OrderNo != 21) { OK = false; } //test to see that result is correct Assert.IsTrue(OK); }
public void FindMethodOK() { //create instance of class we want to create clsServiceOrder AnOrder = new clsServiceOrder(); //boolean var to store result of validation Boolean Found = false; //create test data to use with the method Int32 OrderNo = 1; //invoke method Found = AnOrder.Find(OrderNo); //test to see that result is correcrt and proper Assert.IsTrue(Found); }
public void ServiceExtremeMax() { //create insatance of class clsServiceOrder AnOrder = new clsServiceOrder(); //boolean value to store result of validation., which is intitialised to false Boolean OK = false; //create some test data to assign to property string SomeService = ""; //pad the data with characters.PadRight is a built in method that allows us to pad out an existing string with a set number of a specific character. SomeService = SomeService.PadRight(129, 'a'); //invoke the methoid OK = AnOrder.Valid(SomeService); //test to see if result is ok Assert.IsFalse(OK); }
public void ServiceMaxPlusOne() { //create insatance of class clsServiceOrder AnOrder = new clsServiceOrder(); //boolean value to store result of validation., which is intitialised to false Boolean OK = false; //create some test data to assign to property string SomeService = "abcdefghijklmnopqrstu"; //invoke the methoid OK = AnOrder.Valid(SomeService); //test to see if result is ok Assert.IsFalse(OK); }