public void Expected_Return_DateExtremeMax() { //create an instance of the class we want to create clsOrders AnOrder = new clsOrders(); //string variable to store any error messages String Error = ""; //create some test data to pass to the method string Stock_ID = "5678"; string Order_Date = "12/01/2018"; string Customer_ID = "123456"; string Payment_Method = "Card"; //create a variable to store the test date data DateTime TestDate; //Set the date to todays date TestDate = DateTime.Now.Date; //change the date to whatever the date is plus 100 years TestDate = TestDate.AddYears(100); //convert the date variable to string variable string Expected_Return_Date = TestDate.ToString(); //invoke the method Error = AnOrder.Valid(Stock_ID, Expected_Return_Date, Order_Date, Customer_ID, Payment_Method); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
protected void btnOk_Click(object sender, EventArgs e) { //create a new instance of clsOrders clsOrders AnOrder = new clsOrders(); //capture OrderDate string OrderDate = txtOrderDate.Text; //capture Shippinginfo string ShippingInfo = txtShippingInfo.Text; //variable to store error messages string Error = ""; //validate the data Error = AnOrder.Valid(OrderDate, ShippingInfo); if (Error == "") { //capture the Orderdate AnOrder.OrderDate = Convert.ToDateTime(OrderDate); //capture the shipping info AnOrder.ShippingInfo = ShippingInfo; //store the orderid in the Orders in the session object Session["AnOrder"] = AnOrder; //redirect to the viewer page Response.Write("Ordersviewer.aspx"); } else { //display the error message lblError.Text = Error; } }
public void ValidMethodOK() { clsOrders AnOrder = new clsOrders(); String Error = ""; Error = AnOrder.Valid(OrderId, ItemId, OrderDate, DeliveryAddress, DispatchedStatus, UnitPrice, Quantity, ProductCode); Assert.AreEqual(Error, ""); }
public void QuantityExtremeMax() { clsOrders AnOrder = new clsOrders(); String Error = ""; int Quantity = 2147483647; Error = AnOrder.Valid(OrderId, ItemId, OrderDate, DeliveryAddress, DispatchedStatus, UnitPrice, Quantity, ProductCode); Assert.AreNotEqual(Error, ""); }
public void ProductCodeMaxPlusOne() { clsOrders AnOrder = new clsOrders(); String Error = ""; string ProductCode = "aaaaaaaa"; Error = AnOrder.Valid(OrderId, ItemId, OrderDate, DeliveryAddress, DispatchedStatus, UnitPrice, Quantity, ProductCode); Assert.AreNotEqual(Error, ""); }
public void UnitPriceMaxLessOne() { clsOrders AnOrder = new clsOrders(); String Error = ""; Double UnitPrice = 9999.00; Error = AnOrder.Valid(OrderId, ItemId, OrderDate, DeliveryAddress, DispatchedStatus, UnitPrice, Quantity, ProductCode); Assert.AreEqual(Error, ""); }
public void UnitPriceExtremeMax() { clsOrders AnOrder = new clsOrders(); String Error = ""; Double UnitPrice = Double.MaxValue; Error = AnOrder.Valid(OrderId, ItemId, OrderDate, DeliveryAddress, DispatchedStatus, UnitPrice, Quantity, ProductCode); Assert.AreNotEqual(Error, ""); }
public void ProductCodeExtremeMax() { clsOrders AnOrder = new clsOrders(); String Error = ""; string ProductCode = ""; ProductCode = ProductCode.PadRight(500, 'a'); Error = AnOrder.Valid(OrderId, ItemId, OrderDate, DeliveryAddress, DispatchedStatus, UnitPrice, Quantity, ProductCode); Assert.AreNotEqual(Error, ""); }
public void DeliveryAddressMaxPlusOne() { clsOrders AnOrder = new clsOrders(); String Error = ""; string DeliveryAddress = ""; DeliveryAddress = DeliveryAddress.PadRight(201, 'a'); Error = AnOrder.Valid(OrderId, ItemId, OrderDate, DeliveryAddress, DispatchedStatus, UnitPrice, Quantity, ProductCode); Assert.AreNotEqual(Error, ""); }
public void OrderDateMin() { clsOrders AnOrder = new clsOrders(); String Error = ""; DateTime TestDate; TestDate = DateTime.Now.Date; OrderDate = TestDate; Error = AnOrder.Valid(OrderId, ItemId, OrderDate, DeliveryAddress, DispatchedStatus, UnitPrice, Quantity, ProductCode); Assert.AreEqual(Error, ""); }
public void ValidMethodOK() { //create an instance of the class we want to create clsOrders AnOrder = new clsOrders(); //string variable to store any error message String Error = ""; //invoke the method Error = AnOrder.Valid(CustomerId, ProductId, OrderDate, Description, Price, Status, DateShipped); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void ValidMethodOk() { //create an instance of the class we want to create clsOrders AnOrder = new clsOrders(); //string variable to store error message String Error = ""; //invoke the method Error = AnOrder.Valid(OrderDate, ShippingInfo); //test to see that the results are correct Assert.AreEqual(Error, ""); }
public void PriceMaxPlusOne() { //create an instance of the class that we want to create clsOrders AnOrder = new clsOrders(); //string variable to store any error message String Error = ""; //create some test data to pass to the method string Price = "10000.00"; //invoke the method Error = AnOrder.Valid(CustomerId, ProductId, OrderDate, Description, Price, Status, DateShipped); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void ShippingInfoMid() { //create an instance of the class we want to create clsOrders AnOrder = new clsOrders(); //string variable to store any error message String Error = ""; //this should pass string ShippingInfo = "aaaaaaa"; //invoke the method Error = AnOrder.Valid(OrderDate, ShippingInfo); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void OrderDateInvalidData() { //create an instance of the class clsOrders AnOrder = new clsOrders(); //string variable to store error messages String Error = ""; //set the orderdate to a non date value string OrderDate = "this is not a date!"; //invoke the method Error = AnOrder.Valid(OrderDate, ShippingInfo); //test to see the result is correct Assert.AreNotEqual(Error, ""); }
public void StatusMaxLessOne() { //create an instance of the class that we want to create clsOrders AnOrder = new clsOrders(); //string variable to store any error messages String Error = ""; //create some test data to pass to the method string Status = ""; Status = Status.PadRight(14, 'a'); //invoke the method Error = AnOrder.Valid(CustomerId, ProductId, OrderDate, Description, Price, Status, DateShipped); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void DescriptionExtremeMax() { //create an instance of the cloass we want to create clsOrders AnOrder = new clsOrders(); //string variable to store any error message String Error = ""; //create some test data to pass to the method string Description = ""; Description = Description.PadRight(500, 'a'); //invoke the method Error = AnOrder.Valid(CustomerId, ProductId, OrderDate, Description, Price, Status, DateShipped); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
protected void btnAccept_Click(object sender, EventArgs e) { clsOrders AnOrder = new clsOrders(); int OrderId = Convert.ToInt32(txtOrderId.Text); int ItemId = Convert.ToInt32(txtItemId.Text); DateTime OrderDate = Convert.ToDateTime(txtOrderDate.Text); string DeliveryAddress = txtDeliveryAddress.Text; Double UnitPrice = Convert.ToDouble(txtUnitPrice.Text); int Quantity = Convert.ToInt32(txtQuantity.Text); string ProductCode = txtProductCode.Text; bool DispatchedStatus = chkDispatched.Checked; string Error = ""; Error = AnOrder.Valid(OrderId, ItemId, OrderDate, DeliveryAddress, DispatchedStatus, UnitPrice, Quantity, ProductCode); if (Error == "") { AnOrder.OrderId = OrderId; AnOrder.ItemId = ItemId; AnOrder.OrderDate = Convert.ToDateTime(OrderDate); AnOrder.DeliveryAddress = DeliveryAddress; AnOrder.UnitPrice = UnitPrice; AnOrder.Quantity = Quantity; AnOrder.ProductCode = ProductCode; AnOrder.DispatchedStatus = DispatchedStatus; clsOrderCollection OrdersList = new clsOrderCollection(); if (OrderId == -1) { OrdersList.ThisOrder = AnOrder; OrdersList.Add(); } else { OrdersList.ThisOrder.Find(OrderId); OrdersList.ThisOrder = AnOrder; OrdersList.Update(); } Response.Redirect("OrdersList.aspx"); } else { lblError.Text = Error; } }
public void Payment_MethodMaxPlusOne() { //create an instance of the class we want to create clsOrders AnOrder = new clsOrders(); //string variable to store any error messages String Error = ""; //create some test data to pass to the method string Stock_ID = "5678"; string Expected_Return_Date = "26/01/2018"; string Order_Date = DateTime.Now.Date.ToString(); string Customer_ID = "123456"; string Payment_Method = "Cards"; //invoke the method Error = AnOrder.Valid(Stock_ID, Expected_Return_Date, Order_Date, Customer_ID, Payment_Method); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void Order_DateInvalidData() { //create an instance of the class we want to create clsOrders AnOrder = new clsOrders(); //string variable to store any error messages String Error = ""; //create some test data to pass to the method string Stock_ID = "5678"; string Expected_Return_Date = "26/01/2018"; string Customer_ID = "123456"; string Payment_Method = "Card"; //set the order date to a non date value string Order_Date = "this is not a date"; //invoke the method Error = AnOrder.Valid(Stock_ID, Expected_Return_Date, Order_Date, Customer_ID, Payment_Method); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void OrderDateMin() //3 { //create an instance of the class clsOrders AnOrder = new clsOrders(); //string variable to store error messages String Error = ""; //create a variable to store the test date data DateTime TestDate; //set the date to todays date TestDate = DateTime.Now.Date; //convert the date variable to a string variable string OrderDate = TestDate.ToString(); //invoke the method Error = AnOrder.Valid(OrderDate, ShippingInfo); //test to see the result is correct Assert.AreEqual(Error, ""); }
protected void btnOK_Click(object sender, EventArgs e) { //create a new instance of clsOrders clsOrders AnOrder = new clsOrders(); //capture the Customer Id string CustomerId = txtCustomerId.Text; //capture the Product Id string ProductId = txtProductId.Text; //capture Order Date string OrderDate = txtOrderDate.Text; //capture the Description string Description = txtDescription.Text; //capture the Price string Price = txtPrice.Text; //capture the status string Status = txtStatus.Text; //capture Date Shipped string DateShipped = txtDateShipped.Text; //variabl to store any error messages string Error = ""; //validate the data Error = AnOrder.Valid(CustomerId, ProductId, OrderDate, Description, Price, Status, DateShipped); if (Error == "") { //capture the OrderId AnOrder.OrderId = OrderId; //capture the Customer Id AnOrder.CustomerId = Convert.ToInt32(CustomerId); //capture the Product Id AnOrder.ProductId = ProductId; //capture the Order Date AnOrder.OrderDate = Convert.ToDateTime(OrderDate); //capture the Description AnOrder.Description = Description; //capture the Price AnOrder.Price = Convert.ToDouble(Price); //capture Paid AnOrder.Paid = ChkPaid.Checked; //capture the Status AnOrder.Status = Status; //capture the Date Shipped AnOrder.DateShipped = Convert.ToDateTime(DateShipped); //create a new instance of the order collection clsOrderCollection OrderList = new clsOrderCollection(); //if this is a new record i.e. OrderId = -1 then add the data if (OrderId == -1) { //set the ThisOrder property OrderList.ThisOrder = AnOrder; //add the new record OrderList.Add(); } //otherwise it must be an update else { //find the record to update OrderList.ThisOrder.Find(OrderId); //set the ThisOrder property OrderList.ThisOrder = AnOrder; //update the record OrderList.Update(); } //redirect back to the list page Response.Redirect("OrdersList.aspx"); } else { //display the error message lblError.Text = Error; } }