public void ValidMethodOK() { clsServices AService = new clsServices(); String Error = ""; Error = AService.Valid(ServiceName, Price, Duration, Discount, Staff); Assert.AreEqual(Error, ""); }
public void DiscountMin() { clsServices AService = new clsServices(); //string variable to store the error message String Error = ""; string Discount = "a"; //invoking the method Error = AService.Valid(ServiceName, Staff, Price, Duration, Discount); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void DiscountMaxLessOne() { clsServices AService = new clsServices(); //string variable to store the error message String Error = ""; //create some test data to pass the method string Discount = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; //this should be ok //invoking the method Error = AService.Valid(ServiceName, Staff, Price, Duration, Discount); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void DiscountExtremeMax() { clsServices AService = new clsServices(); //string variable to store the error message String Error = ""; //create some test data to pass the method string Discount = ""; Discount = Discount.PadRight(500, 'a'); //this should fail //invoking the method Error = AService.Valid(ServiceName, Staff, Price, Duration, Discount); //test to see that the result is correct Assert.AreEqual(Error, ""); }
protected void btnOK_Click(object sender, EventArgs e) { clsServices AService = new clsServices(); string ServiceName = txtServiceName.Text; string Staff = txtStaff.Text; string Price = txtPrice.Text; string Duration = txtDuration.Text; string Error = ""; //validate the data Error = AService.Valid(ServiceName, Staff, Price, Duration); if (Error == "") { AService.ServiceName = ServiceName; AService.Staff = Staff; AService.Price = Convert.ToInt32(Price); AService.Duration = Convert.ToInt32(Duration); Session["AService"] = AService; Response.Write("1ServicesView.aspx"); } else { //display the error message lblError.Text = Error; } }