public void ListandCountOK() { clsServicesCollection AllServices = new clsServicesCollection(); List <clsServices> TestList = new List <clsServices>(); clsServices Testitem = new clsServices(); Testitem.Discount = true; Testitem.Duration = 1; Testitem.Price = 1; Testitem.Staff = "Emily"; Testitem.ServiceName = "Haircut"; TestList.Add(Testitem); AllServices.ServiceList = TestList; Assert.AreEqual(AllServices.Count, TestList.Count); }
public void DiscountMaxPlusOne() { clsServices AService = new clsServices(); //string variable to store the error message String Error = ""; //create some test data to pass the method string Discount = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; //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 btnFind_Click(object sender, EventArgs e) { clsServices AService = new clsServices(); String ServiceName; Boolean Found = false; ServiceName = Convert.ToString(txtServiceName.Text); Found = AService.Find(ServiceName); if (Found == true) { txtServiceName.Text = AService.ServiceName; txtStaff.Text = AService.Staff; txtPrice.Text = AService.Price.ToString(); txtDuration.Text = AService.Duration.ToString(); } }
public void PriceExtremeMax() { clsServices AService = new clsServices(); //string variable to store the error message String Error = ""; //create some test data to pass the method string Staff = ""; Price = Price.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; } }