public void UpdateMethodOK() { clsOfficeCollection AllOffices = new clsOfficeCollection(); OfficeClasses TestItem = new OfficeClasses(); Int32 PrimaryKey = 0; TestItem.IsActive = true; TestItem.InspectionDate = DateTime.Now.Date; TestItem.AddressLine1 = "123a"; TestItem.AddressLine2 = "Some Street"; TestItem.City = "Some City"; TestItem.PhoneNumber = "07464074954"; TestItem.PostCode = "LE1 1WE"; AllOffices.ThisOffice = TestItem; PrimaryKey = AllOffices.Add(); TestItem.OfficeCode = PrimaryKey; TestItem.IsActive = false; TestItem.InspectionDate = DateTime.Now.Date; TestItem.AddressLine1 = "123b"; TestItem.AddressLine2 = "Another Street"; TestItem.City = "Another City"; TestItem.PhoneNumber = "07464074954"; TestItem.PostCode = "LE2 2WE"; AllOffices.ThisOffice = TestItem; AllOffices.Update(); AllOffices.ThisOffice.Find(PrimaryKey); Assert.AreEqual(AllOffices.ThisOffice, TestItem); }
public void ValidMethodOK() { OfficeClasses AnOffice = new OfficeClasses(); string Error = ""; Error = AnOffice.Valid(AddressLine1, AddressLine2, City, PostCode, PhoneNumber, InspectionDate); Assert.AreEqual(Error, ""); }
public void Address2ValidMaxMinus1() { OfficeClasses AnOffice = new OfficeClasses(); String Error = ""; string AddressLine2 = "TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"; //this should be ok Error = AnOffice.Valid(AddressLine1, AddressLine2, City, PostCode, PhoneNumber, InspectionDate); Assert.AreEqual(Error, ""); }
public void FindMethodOK() { OfficeClasses AnOffice = new OfficeClasses(); Boolean Found = false; Int32 OfficeCode = 1; Found = AnOffice.Find(OfficeCode); Assert.IsTrue(Found); }
public void CitymaxplusOne() { OfficeClasses AnOffice = new OfficeClasses(); String Error = ""; string City = "TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"; //this should be ok Error = AnOffice.Valid(AddressLine1, AddressLine2, City, PostCode, PhoneNumber, InspectionDate); Assert.AreNotEqual(Error, ""); }
public void InspectionDateInvalidData() { OfficeClasses AnOffice = new OfficeClasses(); String Error = ""; string InspectionDate = "This is not a date!"; Error = AnOffice.Valid(AddressLine1, AddressLine2, City, PostCode, PhoneNumber, InspectionDate); Assert.AreNotEqual(Error, ""); }
public void CityMinPlusOne() { OfficeClasses AnOffice = new OfficeClasses(); String Error = ""; string City = "aa"; Error = AnOffice.Valid(AddressLine1, AddressLine2, City, PostCode, PhoneNumber, InspectionDate); Assert.AreEqual(Error, ""); }
public void Address1ValidMinMinus1() { OfficeClasses AnOffice = new OfficeClasses(); String Error = ""; string AddressLine1 = ""; //this should trigger an error Error = AnOffice.Valid(AddressLine1, AddressLine2, City, PostCode, PhoneNumber, InspectionDate); Assert.AreNotEqual(Error, ""); }
public void Address2ValidMaxExtreme() { OfficeClasses AnOffice = new OfficeClasses(); String Error = ""; string AddressLine2 = ""; AddressLine2 = AddressLine2.PadRight(500, 'T'); // this should fail Error = AnOffice.Valid(AddressLine1, AddressLine2, City, PostCode, PhoneNumber, InspectionDate); Assert.AreNotEqual(Error, ""); }
public void CityMid() { OfficeClasses AnOffice = new OfficeClasses(); String Error = ""; string City = ""; City = City.PadRight(25, 'a'); Error = AnOffice.Valid(AddressLine1, AddressLine2, City, PostCode, PhoneNumber, InspectionDate); Assert.AreEqual(Error, ""); }
public void IsActive() { //create the instance of the class we want to create OfficeClasses AnOffice = new OfficeClasses(); //create some test data to assign to the property Boolean TestData = true; //assign the data to the property AnOffice.IsActive = TestData; //test to see that the two values are the same Assert.AreEqual(AnOffice.IsActive, TestData); }
public void OfficeCode() { //create an instance of the class we want to create OfficeClasses AnOffice = new OfficeClasses(); //create some test data to assign to the property Int32 TestData = 1; //assign the data to the property AnOffice.OfficeCode = TestData; //test to see that the two values are the same Assert.AreEqual(AnOffice.OfficeCode, TestData); }
public void InspectionDateMin() { OfficeClasses AnOffice = new OfficeClasses(); String Error = ""; DateTime TestDate; TestDate = DateTime.Now.Date; string InspectionDate = TestDate.ToString(); Error = AnOffice.Valid(AddressLine1, AddressLine2, City, PostCode, PhoneNumber, InspectionDate); Assert.AreEqual(Error, ""); }
public void TestPostCodeFound() { OfficeClasses AnOffice = new OfficeClasses(); Boolean Found = false; Boolean OK = true; Int32 OfficeCode = 1; Found = AnOffice.Find(OfficeCode); if (AnOffice.PostCode != "ABC DEF") { OK = false; } Assert.IsTrue(OK); }
public void TestInspectionDateFound() { OfficeClasses AnOffice = new OfficeClasses(); Boolean Found = false; Boolean OK = true; Int32 OfficeCode = 1; Found = AnOffice.Find(OfficeCode); if (AnOffice.InspectionDate != Convert.ToDateTime("19/02/2020")) { OK = false; } Assert.IsTrue(OK); }
public void TestAddressLine2Found() { OfficeClasses AnOffice = new OfficeClasses(); Boolean Found = false; Boolean OK = true; Int32 OfficeCode = 1; Found = AnOffice.Find(OfficeCode); if (AnOffice.AddressLine2 != "Test Street 2") { OK = false; } Assert.IsTrue(OK); }
public void TestIsActiveFound() { OfficeClasses AnOffice = new OfficeClasses(); Boolean Found = false; Boolean OK = true; Int32 OfficeCode = 1; Found = AnOffice.Find(OfficeCode); if (AnOffice.IsActive != true) { OK = false; } Assert.IsTrue(OK); }
public void TestPhoneNumberFound() { OfficeClasses AnOffice = new OfficeClasses(); Boolean Found = false; Boolean OK = true; Int32 OfficeCode = 1; Found = AnOffice.Find(OfficeCode); if (AnOffice.PhoneNumber != "12345678910") { OK = false; } Assert.IsTrue(OK); }
public void TestCityFound() { OfficeClasses AnOffice = new OfficeClasses(); Boolean Found = false; Boolean OK = true; Int32 OfficeCode = 1; Found = AnOffice.Find(OfficeCode); if (AnOffice.City != "Test City") { OK = false; } Assert.IsTrue(OK); }
public void ThisOfficePropertyOK() { clsOfficeCollection AllOffices = new clsOfficeCollection(); OfficeClasses TestOffice = new OfficeClasses(); //set its properties TestOffice.IsActive = true; TestOffice.OfficeCode = 1; TestOffice.InspectionDate = DateTime.Now.Date; TestOffice.AddressLine1 = "Flat 108, Ben Russell Court"; TestOffice.AddressLine2 = "25 Grasmere Street"; TestOffice.City = "Leicester"; TestOffice.PhoneNumber = "07464074954"; TestOffice.PostCode = "LE2 7PT"; AllOffices.ThisOffice = TestOffice; Assert.AreEqual(AllOffices.ThisOffice, TestOffice); }
public void ListAndCountOK() { clsOfficeCollection AllOffices = new clsOfficeCollection(); List <OfficeClasses> TestList = new List <OfficeClasses>(); OfficeClasses TestItem = new OfficeClasses(); //set its properties TestItem.IsActive = true; TestItem.OfficeCode = 1; TestItem.InspectionDate = DateTime.Now.Date; TestItem.AddressLine1 = "Flat 108, Ben Russell Court"; TestItem.AddressLine2 = "25 Grasmere Street"; TestItem.City = "Leicester"; TestItem.PhoneNumber = "07464074954"; TestItem.PostCode = "LE2 7PT"; TestList.Add(TestItem); AllOffices.OfficeList = TestList; Assert.AreEqual(AllOffices.Count, TestList.Count); }
public void DeleteMethodOK() { clsOfficeCollection AllOffices = new clsOfficeCollection(); OfficeClasses TestItem = new OfficeClasses(); Int32 PrimaryKey = 0; TestItem.IsActive = true; TestItem.OfficeCode = 3; TestItem.InspectionDate = DateTime.Now.Date; TestItem.AddressLine1 = "123a"; TestItem.AddressLine2 = "Some Street"; TestItem.City = "Some City"; TestItem.PhoneNumber = "07464074954"; TestItem.PostCode = "LE1 1WE"; AllOffices.ThisOffice = TestItem; PrimaryKey = AllOffices.Add(); TestItem.OfficeCode = PrimaryKey; AllOffices.ThisOffice.Find(PrimaryKey); AllOffices.Delete(); Boolean Found = AllOffices.ThisOffice.Find(PrimaryKey); Assert.IsFalse(Found); }
public void InstanceOK() { OfficeClasses AnOffice = new OfficeClasses(); Assert.IsNotNull(AnOffice); }
private void BuildAdRatesTable() { var officeClassesTable = OfficeClasses.GetAllData(); var htmlTable = InitializeAdRatesTable(); foreach (var officeClass in officeClassesTable) { var tr = new TableRow(); htmlTable.Controls.Add(tr); tr.CssClass = "office-class"; var tdName = new TableCell(); tr.Controls.Add(tdName); tdName.CssClass = "table-name"; tdName.Text = officeClass.Name; var tdLevel = new TableCell(); tr.Controls.Add(tdLevel); tdLevel.CssClass = "table-level table-mainlevel"; tdLevel.Text = officeClass.OfficeLevel.ToString(); var tdSubLevel = new TableCell(); tr.Controls.Add(tdSubLevel); tdSubLevel.CssClass = "table-level table-sublevel"; tdSubLevel.Text = officeClass.AlternateOfficeLevel.ToString(); var tdGeneralRate = new TableCell(); tr.Controls.Add(tdGeneralRate); tdGeneralRate.CssClass = "table-rate table-general-rate"; var generalRate = officeClass.GeneralAdRate.ToString(CultureInfo.InvariantCulture); var tdGeneralRateInput = new HtmlInputText { Value = generalRate }; tdGeneralRateInput.Attributes.Add("data-original", generalRate); tdGeneralRate.Controls.Add(tdGeneralRateInput); var tdPrimaryRate = new TableCell(); tr.Controls.Add(tdPrimaryRate); tdPrimaryRate.CssClass = "table-rate table-primary-rate"; var primaryRate = officeClass.PrimaryAdRate.ToString(CultureInfo.InvariantCulture); var tdPrimaryRateInput = new HtmlInputText { Value = primaryRate }; tdPrimaryRateInput.Attributes.Add("data-original", primaryRate); tdPrimaryRate.Controls.Add(tdPrimaryRateInput); } var extraAdRates = new[] { new { Name = "Home Page Ad", Type = "H", Rate = DB.Vote.Master.GetHomeAdRate(0) }, new { Name = "Ballot Page Ad", Type = "B", Rate = DB.Vote.Master.GetBallotAdRate(0) }, new { Name = "Elected Page Ad", Type = "E", Rate = DB.Vote.Master.GetElectedAdRate(0) }, new { Name = "Compare Page Ad", Type = "C", Rate = DB.Vote.Master.GetContestAdRate(0) } }; foreach (var adRate in extraAdRates) { var tr = new TableRow(); htmlTable.Controls.Add(tr); tr.CssClass = "office-class"; var tdName = new TableCell(); tr.Controls.Add(tdName); tdName.CssClass = "table-name"; tdName.Text = adRate.Name; tdName.Attributes.Add("data-type", adRate.Type); new TableCell().AddTo(tr); new TableCell().AddTo(tr); var rate = new TableCell(); tr.Controls.Add(rate); rate.CssClass = "table-rate table-general-rate"; var generalRate = adRate.Rate.ToString(CultureInfo.InvariantCulture); var tdGeneralRateInput = new HtmlInputText { Value = generalRate }; tdGeneralRateInput.Attributes.Add("data-original", generalRate); rate.Controls.Add(tdGeneralRateInput); new TableCell().AddTo(tr); } }