//testing that the siteID of a Site object of 1 is valid public void TestThatSiteIDOfOneIsValid() { testSite.siteID = 1; var results = HelperTestModel.Validate(testSite); Assert.AreEqual(0, results.Count); }
public void TestThatSiteFrequencyOfBiWeeklyIsValid() { testSite.frequency = Site.PickupFrequency.BiWeekly; var results = HelperTestModel.Validate(testSite); Assert.AreEqual(0, results.Count); }
//testing that the address of a Site object can be 1 character public void TestThatSiteAddressOfOneCharacterIsValid() { testSite.address = "a"; var results = HelperTestModel.Validate(testSite); Assert.AreEqual(0, results.Count); }
//testing that the address of a Site object can be 200 characters public void TestThatSiteAddressOf200CharactersIsValid() { testSite.address = new string('a', 200); var results = HelperTestModel.Validate(testSite); Assert.AreEqual(0, results.Count); }
//Test that a Site object with an "empty" frequency is not valid public void TestThatSiteFrequencyOfZeroIsInvalid() { testSite.frequency = 0; var results = HelperTestModel.Validate(testSite); Assert.AreEqual(1, results.Count); Assert.AreEqual("Pickup Frequency must be Weekly or BiWeekly", results[0].ErrorMessage); }
public void TestThatCollectionDayOfWeekMondayToFridayIsValid() { testSite.sitePickupDays = Site.PickupDays.Monday | Site.PickupDays.Tuesday | Site.PickupDays.Wednesday | Site.PickupDays.Thursday | Site.PickupDays.Friday; var results = HelperTestModel.Validate(testSite); Assert.AreEqual(0, results.Count); }
public void TestThatValidSiteObjectIsCreatedWithValidSiteInformation() { Site site = SiteParser.GenerateSiteObjectFromRow(cellList, false); var results = HelperTestModel.Validate(site); Assert.AreEqual(0, results.Count); }
//testing that the address of a Site object cannot be an empty string public void TestThatSiteAddressOfEmptyStringIsInvalid() { testSite.address = ""; var results = HelperTestModel.Validate(testSite); Assert.AreEqual(1, results.Count); Assert.AreEqual("Address must be 1 to 200 characters", results[0].ErrorMessage); }
//testing that siteID cannot be 0 public void TestThatSideIDOfZeroIsInvalid() { testSite.siteID = 0; var results = HelperTestModel.Validate(testSite); Assert.AreEqual(1, results.Count); Assert.AreEqual("The siteID must be a valid integer", results[0].ErrorMessage); }
public void TestThatInvalidDayOfWeekFailsValidation(Site.PickupDays day) { testSite.sitePickupDays = day; var results = HelperTestModel.Validate(testSite); Assert.AreEqual(1, results.Count); Assert.AreEqual("Specified Pickup Days are invalid", results[0].ErrorMessage); }
public void TestThatSiteObjectWithAddressOf200PassesValidation() { // Address field cellList[7] = new string('a', 200); Site site = SiteParser.GenerateSiteObjectFromRow(cellList, false); var results = HelperTestModel.Validate(site); Assert.AreEqual(0, results.Count); }
public void TestThatSiteObjectWithAddressOf201FailsValidation() { // Address field cellList[7] = new string('a', 201); Site site = SiteParser.GenerateSiteObjectFromRow(cellList, false); var results = HelperTestModel.Validate(site); Assert.AreEqual(1, results.Count); Assert.AreEqual("Address must be 1 to 200 characters", results[0].ErrorMessage); }
public void TestThatSiteObjectWithPickupDayOfInvalidFailsValidation() { // PickupDay field cellList[15] = "sdfafa"; Site site = SiteParser.GenerateSiteObjectFromRow(cellList, false); var results = HelperTestModel.Validate(site); Assert.AreEqual(1, results.Count); Assert.AreEqual("Specified Pickup Days are invalid", results[0].ErrorMessage); }
public void TestThatSiteObjectWithFrequencyOfInvalidFailsValidation() { // Frequency field cellList[10] = "sdfafa"; Site site = SiteParser.GenerateSiteObjectFromRow(cellList, false); var results = HelperTestModel.Validate(site); Assert.AreEqual(1, results.Count); Assert.AreEqual("Pickup Frequency must be Weekly or BiWeekly", results[0].ErrorMessage); }
public void TestThatTooFewColumnsInExcelSheetReturnsASiteObjectWithIDOfNegativeTwo() { cellList.Remove(cellList[5]); cellList.Remove(cellList[6]); Site site = SiteParser.GenerateSiteObjectFromRow(cellList, true); var results = HelperTestModel.Validate(site); Assert.AreEqual(3, results.Count); Assert.AreEqual("The siteID must be a valid integer", results[0].ErrorMessage); Assert.AreEqual("Pickup Frequency must be Weekly or BiWeekly", results[1].ErrorMessage); Assert.AreEqual("Specified Pickup Days are invalid", results[2].ErrorMessage); }
public void TestThatTooManyColumnsInExcelSheetReturnsASiteObjectWithIDOfNegativeTwo() { // Adding an extra column (which is 1 too many) cellList.Add("Sdawdawdawdaw"); Site site = SiteParser.GenerateSiteObjectFromRow(cellList, true); var results = HelperTestModel.Validate(site); Assert.AreEqual(3, results.Count); Assert.AreEqual("The siteID must be a valid integer", results[0].ErrorMessage); Assert.AreEqual("Pickup Frequency must be Weekly or BiWeekly", results[1].ErrorMessage); Assert.AreEqual("Specified Pickup Days are invalid", results[2].ErrorMessage); }
public void TestThatHeaderRowWithValidDataReturnsASiteObjectWithSiteIDOf1() { cellList[1] = "Site ID"; cellList[7] = "Full Address"; cellList[10] = "Frequency"; cellList[15] = "Collection1"; cellList[16] = "Collection2"; cellList[17] = "Collection3"; cellList[18] = "Collection4"; Site site = SiteParser.GenerateSiteObjectFromRow(cellList, true); Assert.AreEqual(1, site.siteID); var results = HelperTestModel.Validate(site); Assert.AreEqual(0, results.Count); }
public void TestThatHeaderRowWithInValidDataReturnsAnInvalidSiteObject() { cellList[1] = "Site ID"; cellList[7] = "Full Address"; cellList[10] = "Frequency"; cellList[15] = "Colleasdasction1"; cellList[16] = "Collection2"; cellList[17] = "Collection3"; cellList[18] = "Collection4"; Site site = SiteParser.GenerateSiteObjectFromRow(cellList, true); var results = HelperTestModel.Validate(site); Assert.AreEqual(3, results.Count); Assert.AreEqual("The siteID must be a valid integer", results[0].ErrorMessage); Assert.AreEqual("Pickup Frequency must be Weekly or BiWeekly", results[1].ErrorMessage); Assert.AreEqual("Specified Pickup Days are invalid", results[2].ErrorMessage); }
public void TestThatInvalidSiteObjectIsCreatedWithInvalidSiteInformation() { // Site ID cellList[1] = "jdasdfa"; // Address cellList[7] = ""; // Frequency cellList[10] = "jdfsal"; // Collection1 cellList[15] = "23kjl32"; Site site = SiteParser.GenerateSiteObjectFromRow(cellList, false); var results = HelperTestModel.Validate(site); Assert.AreEqual(4, results.Count); Assert.AreEqual("The siteID must be a valid integer", results[0].ErrorMessage); Assert.AreEqual("Address must be 1 to 200 characters", results[1].ErrorMessage); Assert.AreEqual("Pickup Frequency must be Weekly or BiWeekly", results[2].ErrorMessage); Assert.AreEqual("Specified Pickup Days are invalid", results[3].ErrorMessage); }
//testing that the valid Site object is indeed valid public void TestThatValidSiteIsValid() { var results = HelperTestModel.Validate(testSite); Assert.AreEqual(0, results.Count); }