public void PhoneMakeMinPulsOne() { //create an instance of the class clsStock AnStock = new clsStock(); //string variable to store error message string Error = ""; //create some test data to pass to the method string PhoneMake = "ss"; //invoke the method Error = AnStock.Valid(PhoneID, PhoneMake, PhoneModel, PhoneDescription); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void PriceMinLessOne() { //create an instance of the class we want to create clsStock AnStock = new clsStock(); //string variable to store any error message String Error = ""; //creating some test data string Price = "0";//Should fail //invokes the method Error = AnStock.Valid(gameName, Price, AgeRating, ReleaseDate); //test to see correct result Assert.AreNotEqual(Error, ""); }
public void TestReleaseDateFound() { clsStock AStock = new clsStock(); Boolean Found = false; Boolean OK = true; long BookID = 9780545010221; Found = AStock.Find(BookID); if (AStock.ReleaseDate != Convert.ToDateTime("21/7/2007")) { OK = false; } Assert.IsTrue(OK); }
public void TestBookIDNotFound() { clsStock AStock = new clsStock(); Boolean Found = false; Boolean OK = true; long BookID = 9780545010221; Found = AStock.Find(BookID); if (AStock.BookID != 9780545010221) { OK = false; } Assert.IsTrue(OK); }
public void FindMethodOK() { //creates an instance of the class we want to create clsStock AnStock = new clsStock(); Boolean Found = false; //tests for random ID to see if it can find the primary key Int32 gameID = 2; Found = AnStock.Find(gameID); //test to see correct result Assert.IsTrue(Found); }
public void TestBookNameNotFound() { clsStock AStock = new clsStock(); Boolean Found = false; Boolean OK = true; long BookID = 9780545010221; Found = AStock.Find(BookID); if (AStock.BookName != "Harry Potter and the Deathly Hallows") { OK = false; } Assert.IsTrue(OK); }
public void MileageMaxPlusOne() { clsStock AStock = new clsStock(); String Error = ""; int testMileage = 200001; string mileage = testMileage.ToString(); Error = AStock.Valid(productionDate, mileage, price, sold, modelName); Assert.AreNotEqual(Error, ""); }
public void GameNameNotNull() { //creates an instance of the class we want to create clsStock AnStock = new clsStock(); //string variable to store any error message string Error = ""; //creates test data string TestData = TestString; //invokes method Error = AnStock.Valid(TestString); //test to see the correct result Assert.AreEqual(Error, ""); }
public void PriceMax() { //create an instance of the class stock clsStock AStock = new clsStock(); //string variable to store the error messsage //string price shows the max String Error = ""; string Price = "aaaaaa"; //invoke method Error = AStock.Valid(StockId, ItemName, Quantity, Price, StockAvailable, DatePurchased); //test to see if it works Assert.AreEqual(Error, ""); }
public void PriceExtremeMax() { //create an instance of the class stock clsStock AStock = new clsStock(); //string variable to store the error message String Error = ""; string Price = ""; Price = Price.PadRight(500, 'a'); //invoke method Error = AStock.Valid(StockId, ItemName, Quantity, Price, StockAvailable, DatePurchased); //test to see if it works Assert.AreNotEqual(Error, ""); }
public void QuantityMaxLessOne() { //create an instance of the class stock clsStock AStock = new clsStock(); //string variable to store the error message String Error = ""; string Quantity = ""; Quantity = Quantity.PadRight(9, 'a'); //invoke method Error = AStock.Valid(StockId, ItemName, Quantity, Price, StockAvailable, DatePurchased); //test to see if it works Assert.AreEqual(Error, ""); }
public void FindMethodOK() { //create an instance of the class stock clsStock AStock = new clsStock(); //boolean value to store the result of the validation Boolean Found = false; //create some test data to use with the method Int32 StockId = 1; //invoke method Found = AStock.Find(StockId); //test to see if results are true Assert.IsTrue(Found); }
public void StockDescriptionExtremeMax() { clsStock AnStock = new clsStock(); String Error = ""; string StockDescription = ""; StockDescription = StockDescription.PadRight(1000, 'a'); Error = AnStock.Valid(StockAvailability, StockDescription, StockPrice); Assert.AreNotEqual(Error, ""); }
public void StockDescriptionMaxMinusOne() { clsStock AnStock = new clsStock(); String Error = ""; string StockDescription = ""; StockDescription = StockDescription.PadRight(199, 'a'); Error = AnStock.Valid(StockAvailability, StockDescription, StockPrice); Assert.AreEqual(Error, ""); }
public void priceMid() { clsStock AStock = new clsStock(); String Error = ""; int testPrice = 50000; string price = testPrice.ToString(); Error = AStock.Valid(productionDate, mileage, price, sold, modelName); Assert.AreEqual(Error, ""); }
public void AgeRatingMin() { //create an instance of the class we want to create clsStock AnStock = new clsStock(); //string variable to store any error message String Error = ""; //creates test data string AgeRating = "3";//this should pass //invoke the method Error = AnStock.Valid(gameName, Price, AgeRating, ReleaseDate); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void soldMax() { clsStock AStock = new clsStock(); String Error = ""; bool testSold = true; string sold = testSold.ToString(); Error = AStock.Valid(productionDate, mileage, price, sold, modelName); Assert.AreEqual(Error, ""); }
public void MinLessOne() { //creates an instance of the class we want to create clsStock AnStock = new clsStock(); //string variable to store any error message string Error = ""; //creates test data as a String string TestData = ""; //invokes method Error = AnStock.Valid(TestData); //tests to see correct result Assert.AreNotEqual(Error, ""); }
public void ModelNameMaxPlusOne() { clsStock AStock = new clsStock(); String Error = "twentyonecharactersss"; string testModelName = ""; string modelName = testModelName.ToString(); Error = AStock.Valid(productionDate, mileage, price, sold, modelName); Assert.AreNotEqual(Error, ""); }
public void GameNameMaxLessOne() { //create an instance of the class we want to create clsStock AnStock = new clsStock(); //string variable to store any error message String Error = ""; //create some test data to pass to the method string gameName = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; //this should be ok //invoke the method Error = AnStock.Valid(gameName, Price, AgeRating, ReleaseDate); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void ModelNameMid() { clsStock AStock = new clsStock(); String Error = ""; string testModelName = "tencharact"; string modelName = testModelName.ToString(); Error = AStock.Valid(productionDate, mileage, price, sold, modelName); Assert.AreEqual(Error, ""); }
public void TestNumberAvailableNotFound() { clsStock AStock = new clsStock(); Boolean Found = false; Boolean OK = true; long BookID = 9780545010221; Found = AStock.Find(BookID); if (AStock.NumberAvailable != 59) { OK = false; } Assert.IsTrue(OK); }
public void FindMethodOK() { //create an instance of the class we want to create clsStock someStock = new clsStock(); //boolean variable to store the result of the validation Boolean Found = false; //create some test data to use with the method int ItemID = 2; //invoke the method Found = someStock.Find(ItemID); //test to see that the result is correct Assert.IsTrue(Found); }
public void BookNameMaxPlusOne() { //create an instance of the class we want to create clsStock AStock = new clsStock(); //string variable to store any error message String Error = ""; //this should fail string BookName = ""; //invoke method Error = AStock.Valid(BookName, NumberAvailable, ReleaseDate); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void SupplierExtremeMax() { clsStock someStock = new clsStock(); //string variable to store any error message String Error = ""; //create test data to pass the method string Supplier = ""; Supplier = Supplier.PadRight(1000, 'a'); //invoke the method Error = someStock.Valid(ItemName, ItemType, StockQuantity.ToString(), Price.ToString(), Supplier, NextRestock); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void PhoneIDMin() { //create an instance of the class clsStock AnStock = new clsStock(); //string to store the variable string Error = ""; //create some test data to pass to the method Int32 PhoneID = 1; //invoke the method Error = AnStock.Valid(PhoneID, PhoneMake, PhoneModel, PhoneDescription); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void GameNameMinLessOne() { //Create an instance of clsStock clsStock AnStock = new clsStock(); //String varible to create an Error message String Error = ""; //Creating some test data string gameName = "";//This should pass //Invokes the method Error = AnStock.Valid(gameName, Price, AgeRating, ReleaseDate); //Test to see if result is correct Assert.AreNotEqual(Error, ""); }
public void StockAvailabilityMin() { clsStock AnStock = new clsStock(); String Error = ""; string StockAvailability = "0"; Error = AnStock.Valid(StockAvailability, StockDescription, StockPrice); Console.WriteLine(Error); Assert.AreEqual(Error, ""); }
protected void BtnOK_Click(object sender, EventArgs e) { //new instance of the stock class clsStock ABook = new clsStock(); //Capture the input fields string ISBN = txtISBN.Text; string Price = txtPrice.Text; string SupplierID = txtSupplierID.Text; string StockLevel = txtStockLevel.Text; string Author = txtAuthor.Text; string BookName = txtBookName.Text; string ReleaseDate = txtReleaseDate.Text; Boolean OnOrder = chkOnOrder.Checked; //String to contain any errors string Error = ""; //validate Error = ABook.Valid(ISBN, Price, StockLevel, BookName, Author, SupplierID, ReleaseDate); if (Error == "") { ABook.ISBN = ISBN; ABook.Price = Convert.ToDouble(Price); ABook.SupplierID = Convert.ToInt32(SupplierID); ABook.StockLevel = Convert.ToInt32(StockLevel); ABook.Author = Author; ABook.BookName = BookName; ABook.ReleaseDate = Convert.ToDateTime(ReleaseDate); ABook.OnOrder = OnOrder; clsStockCollection StockList = new clsStockCollection(); if (nStockID == -1) { StockList.ThisStock = ABook; StockList.Add(); Response.Redirect("StockList.aspx"); } else { StockList.ThisStock.Find(nStockID); StockList.ThisStock = ABook; StockList.Update(); Response.Redirect("StockList.aspx"); } } else { LabelError.Text = Error; } }
protected void btnOK_Click1(object sender, EventArgs e) { //create a new instance of clsStock clsStock someStock = new clsStock(); //capture the inputs as strings String ItemName = txtItemName.Text; String ItemType = txtItemType.Text; String StockQuantity = txtStockQuantity.Text; String Price = txtPrice.Text; String Supplier = txtSupplier.Text; String NextRestock = txtNextRestock.Text; String Error = ""; // validate the data Error = someStock.Valid(ItemName, ItemType, StockQuantity, Price, Supplier, NextRestock); if (Error == "")//If it was fine collect the data { someStock.ItemID = ItemID; someStock.ItemName = ItemName; someStock.ItemType = ItemType; someStock.StockQuantity = Int32.Parse(StockQuantity); someStock.Price = Double.Parse(Price); someStock.Supplier = Supplier; someStock.NextRestock = Convert.ToDateTime(NextRestock); //create a new instance of item collection clsItemCollection ItemList = new clsItemCollection(); //if this is a new record i.e. ItemID = -1 then add the data if (someStock.ItemID == -1) { someStock.ItemID = Int32.Parse(txtItemID.Text); ItemList.ThisItem = someStock; ItemList.Add(); } //otherwise it must be an update else { ItemList.ThisItem.Find(someStock.ItemID); ItemList.ThisItem = someStock; ItemList.Update(); } Response.Redirect("StockList.aspx"); } else { lblError.Text = Error; } }