示例#1
0
 def test_PositiveValidation_ShouldAcceptPositiveData(self):
     office = Office()
     office.Code = -1
     office.UnitNumber = -100
     office.FloorNo = 10
     office.SectionNo = 5
     officeValidation = OfficeValidation()
     result = officeValidation.validate(office)
     assert result is None
示例#2
0
 def test_PositiveValidation_ShouldAcceptDataWithValueOfZeroIfZeroIsIncluded(self):
     office = Office()
     office.Code = -1
     office.UnitNumber = -100
     office.FloorNo = 10
     office.SectionNo = 0
     officeValidation = OfficeValidation()
     result = officeValidation.validate(office)
     assert result is None
示例#3
0
 def test_SizeValidation_ShouldAcceptValueWhichIsAvailableInMaxMinBoundry(self):
     office = Office()
     office.Code = -1
     office.UnitNumber = -100
     office.FloorNo = 10
     office.SectionNo = 5
     officeValidation = OfficeValidation()
     result = officeValidation.validate(office)
     assert result is None
示例#4
0
 def test_available_date_string_validation_should_accept_string_of_date_time(self):
     valid_date_string = '2015-07-05 09:42:29.502653'
     office = Office()
     office.date = valid_date_string
     office.Code = -1
     office.UnitNumber = 0
     office.FloorNo = 10
     office.SectionNo = 5
     officeValidation = OfficeValidation()
     result = officeValidation.validate(office)
     assert result is None
示例#5
0
 def test_NegativeValidation_ShouldGuaranteeTheValueIsNegative(self):
     try:
         office = Office()
         office.Code = 10
         office.UnitNumber = 5
         office.FloorNo = 10
         office.SectionNo = 5
         officeValidation = OfficeValidation()
         result = officeValidation.validate(office)
         assert result is not None
     except ValidationException as ex:
         assert ex.Errors
示例#6
0
 def test_PositiveValidation_ShouldReturnValidationErrorIfZeroIsNotIncluded(self):
     try:
         office = Office()
         office.Code = -1
         office.UnitNumber = -100
         office.FloorNo = 0
         office.SectionNo = 5
         officeValidation = OfficeValidation()
         result = officeValidation.validate(office)
         assert result is not None
     except ValidationException as ex:
         assert ex.Errors
示例#7
0
 def test_SizeValidation_ShouldGuranteeValueShouldNotBeHigherThanMaxValue(self):
     try:
         office = Office()
         office.Code = -1
         office.UnitNumber = -100
         office.FloorNo = 16
         office.SectionNo = 5
         officeValidation = OfficeValidation()
         result = officeValidation.validate(office)
         assert result is not None
     except ValidationException as ex:
         assert ex.Errors
示例#8
0
 def test_available_date_string_validation_should_not_accept_string_of_none_date_time(self):
     try:
         valid_date_string = 'not date time string!!'
         office = Office()
         office.date = valid_date_string
         office.Code = -1
         office.UnitNumber = 0
         office.FloorNo = 10
         office.SectionNo = 5
         officeValidation = OfficeValidation()
         result = officeValidation.validate(office)
         assert result is not None
     except ValidationException as ex:
         assert ex.Errors