public void UpdateMethodOK() { //create instance of class we want to create clsConsoleCollection AllConsoles = new clsConsoleCollection(); //creates item for test data clsConsole TestItem = new clsConsole(); Int32 PrimaryKey = 0; //set properties TestItem.ConsoleNo = 1; TestItem.Name = "Xbox"; TestItem.Manufacturer = "Microsoft"; TestItem.Price = 250; TestItem.Stock = 10000; AllConsoles.ThisConsole = TestItem; PrimaryKey = AllConsoles.Add(); //modify test data TestItem.ConsoleNo = 5; TestItem.Name = "PlayStation 4 Pro"; TestItem.Manufacturer = "Sony"; TestItem.Price = 400; TestItem.Stock = 2000; AllConsoles.ThisConsole = TestItem; //update record AllConsoles.Update(); //find record AllConsoles.ThisConsole.Find(PrimaryKey); //test to see ThisConsole matches test data Assert.AreEqual(AllConsoles.ThisConsole, TestItem); }
public void DeleteMethodOK() { //create instance of the class we want to create clsConsoleCollection AllConsoles = new clsConsoleCollection(); clsConsole TestItem = new clsConsole(); Int32 PrimaryKey = 0; //sets properties TestItem.ConsoleNo = 1; TestItem.Name = "Xbox"; TestItem.Manufacturer = "Microsoft"; TestItem.Price = 250; TestItem.Stock = 10000; AllConsoles.ThisConsole = TestItem; //add record PrimaryKey = AllConsoles.Add(); TestItem.ConsoleNo = PrimaryKey; AllConsoles.ThisConsole.Find(PrimaryKey); AllConsoles.Delete(); //finds record Boolean Found = AllConsoles.ThisConsole.Find(PrimaryKey); //tests to see that record was not found Assert.IsFalse(Found); }
public void ValidMethodOK() { clsConsole AConsole = new clsConsole(); String Error = ""; Error = AConsole.Valid(ConsoleManufacturer, ConsoleName, ConsolePrice, ConsoleStock); Assert.AreEqual(Error, ""); }
public void FindMethodOK() { clsConsole AConsole = new clsConsole(); //boolean to store result of search Boolean Found = false; Int32 ConsoleNo = 2; Found = AConsole.Find(ConsoleNo); Assert.IsTrue(Found); }
public void AllConsolesOK() { clsConsoleCollection Console = new clsConsoleCollection(); List <clsConsole> TestList = new List <clsConsole>(); clsConsole TestItem = new clsConsole(); TestItem.ConsoleNo = 1; TestList.Add(TestItem); Console.AllConsoles = TestList; Assert.AreEqual(Console.AllConsoles, TestList); }
public void StockQuantityPropertyOK() { //instance of class clsConsole AConsole = new clsConsole(); //Console data to assign to property Int32 TestData = 25000; //assigns data to the property AConsole.Stock = TestData; //test to see if they ae the same Assert.AreEqual(AConsole.Stock, TestData); }
public void ConsoleStockMinPlusOne() { //create an instance clsConsole AConsole = new clsConsole(); String Error = ""; //create some test data to pass to the method string ConsoleStock = "1"; Error = AConsole.Valid(ConsoleManufacturer, ConsoleName, ConsolePrice, ConsoleStock); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void PricePropertyOK() { //instance of class clsConsole AConsole = new clsConsole(); //Console data to assign to property Int32 TestData = 500; //assigns data to the property AConsole.Price = TestData; //test to see if they ae the same Assert.AreEqual(AConsole.Price, TestData); }
public void ManufacturerPopertyOK() { //instance of class clsConsole AConsole = new clsConsole(); //Console data to assign to property string TestData = "Microsoft"; //assigns data to the property AConsole.Manufacturer = TestData; //test to see if they ae the same Assert.AreEqual(AConsole.Manufacturer, TestData); }
public void ConsolePropertyOK() { //instance of class clsConsole AConsole = new clsConsole(); //Console data to assign to property string TestData = "Xbox"; //assigns data to the property AConsole.Console = TestData; //test to see if they ae the same Assert.AreEqual(AConsole.Console, TestData); }
public void ConsolePriceMid() { //create an instance clsConsole AConsole = new clsConsole(); String Error = ""; //create some test data to pass to the method string ConsolePrice = "1231231231231231231231231123123123123123123123123112312312312312312312312311231231231231231231231231123123123123123123123123112312312312312312312312311231231231231231231231231123123123123123123123123112312312312312312312312311231231231231231231231231"; //this should be ok //invoke the method Error = AConsole.Valid(ConsoleManufacturer, ConsoleName, ConsolePrice, ConsoleStock); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void TestConsoleNo() { clsConsole AConsole = new clsConsole(); Boolean Found = false; Boolean OK = true; Int32 ConsoleNo = 2; Found = AConsole.Find(ConsoleNo); if (AConsole.ConsoleNo != 2) { OK = false; } Assert.IsTrue(OK); }
public void ConsoleListOK() { //creates instance of class we want to create clsConsoleCollection AllConsoles = new clsConsoleCollection(); List <clsConsole> TestList = new List <clsConsole>(); clsConsole TestItem = new clsConsole(); //sets properties TestItem.ConsoleNo = 1; TestItem.Name = "Xbox"; TestItem.Manufacturer = "Microsoft"; TestItem.Price = 250; TestItem.Stock = 10000; TestList.Add(TestItem); AllConsoles.ConsoleList = TestList; Assert.AreEqual(AllConsoles.ConsoleList, TestList); }
public void AddMethodOK() { clsConsoleCollection AllConsoles = new clsConsoleCollection(); clsConsole TestItem = new clsConsole(); Int32 PrimaryKey = 0; //sets properties TestItem.ConsoleNo = 1; TestItem.Name = "Xbox"; TestItem.Manufacturer = "Microsoft"; TestItem.Price = 250; TestItem.Stock = 10000; AllConsoles.ThisConsole = TestItem; PrimaryKey = AllConsoles.Add(); TestItem.ConsoleNo = PrimaryKey; AllConsoles.ThisConsole.Find(PrimaryKey); Assert.AreEqual(AllConsoles.ThisConsole, TestItem); }
public ClsConsoleCollection() { Int32 Index = 0; Int32 RecordCount = 0; clsDataConnection DB = new clsDataConnection(); DB.Execute("Sproc_tblConsole_SelectAll"); RecordCount = DB.Count; while (Index < RecordCount) { clsConsole AConsole = new clsConsole(); AConsole.ConsoleNo = Convert.ToInt32(DB.DataTable.Rows[Index]["ConsoleNo"]); AConsole.Name = Convert.ToString(DB.DataTable.Rows[Index]["ConsoleName"]); AConsole.Manufacturer = Convert.ToString(DB.DataTable.Rows[Index]["ConsoleManufacturer"]); AConsole.Price = Convert.ToInt32(DB.DataTable.Rows[Index]["ConsolePrice"]); AConsole.Stock = Convert.ToInt32(DB.DataTable.Rows[Index]["ConsoleStock"]); mConsoleList.Add(AConsole); Index++; } }
public void InstanceOK() { clsConsole AConsole = new clsConsole(); Assert.IsNotNull(AConsole); }