public void VaildMethodOK() { //create an instance of the class we want to create clsOrder AnOrder = new clsOrder(); //string variable to store String Error = ""; //invoke the method Error = AnOrder.Vaild(DeliveryDate, OrderDate, PartNo); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void OrderDateInvaildDate() { //create an instance of the class we want to create clsOrder AnOrder = new clsOrder(); //string variable to store string Error = ""; //create some test data to pass the method string OrderDate = "this is not a date!"; //invoke the method Error = AnOrder.Vaild(DeliveryDate, OrderDate, PartNo); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void OrderDateExtremeOk() { //create an instance of the class we want to create clsOrder AnOrder = new clsOrder(); //string variable to store String Error = ""; //create a variable to store the test data DateTime TestDate; //set the date to todays date TestDate = DateTime.Now.Date; //change the date to whatever the date is less 100 years TestDate = TestDate.AddYears(+500); //create some test data to pass the method string OrderDate = TestDate.ToString(); //invoke the method Error = AnOrder.Vaild(DeliveryDate, OrderDate, PartNo); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
protected void btnOk_Click(object sender, EventArgs e) { clsOrder AOrder = new clsOrder(); string OrderDate = txtOrderDate.Text; string DeliveryDate = txtDeliveryDate.Text; string PartNo = txtPartNo.Text; string Error = ""; Error = AOrder.Vaild(OrderDate, DeliveryDate, PartNo); if (Error == "") { AOrder.OrderDate = Convert.ToDateTime(OrderDate); AOrder.DeliveryDate = Convert.ToDateTime(DeliveryDate); AOrder.PartNo = Convert.ToInt32(PartNo); Session["AOrder"] = AOrder; Response.Write("OrderViewer.aspx"); } else { lblError.Text = Error; } if (OrderNo == -1) { Add(); Response.Redirect("OrderViewer.aspx"); } else { Update(); Response.Redirect("OrderDefault.aspx"); } }