public void ShouldBeFutureDateTime_WhenValueDateTimeIsAfterNow_ReturnsDateTimeValidator() { IDateTimeValidator sut = CreateSut(); DateTime value = DateTime.Now.AddSeconds(_random.Next(5, 30)); IValidator result = sut.ShouldBeFutureDateTime(value, GetType(), _fixture.Create <string>()); Assert.That(result, Is.TypeOf <BusinessLogic.Validation.DateTimeValidator>()); }
public void ShouldBeFutureDateTime_WhenValueDateTimeIsNow_ThrowsIntranetValidationException() { IDateTimeValidator sut = CreateSut(); DateTime value = DateTime.Now; Type validatingType = GetType(); string validatingField = _fixture.Create <string>(); IntranetValidationException result = Assert.Throws <IntranetValidationException>(() => sut.ShouldBeFutureDateTime(value, validatingType, validatingField)); Assert.That(result.ErrorCode, Is.EqualTo(ErrorCode.ValueShouldBeFutureDateTime)); Assert.That(result.ValidatingType, Is.EqualTo(validatingType)); Assert.That(result.ValidatingField, Is.EqualTo(validatingField)); }
public void ShouldBeFutureDateTime_WhenValidatingFieldIsWhiteSpace_ThrowsArgumentNullException() { IDateTimeValidator sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.ShouldBeFutureDateTime(_fixture.Create <DateTime>(), GetType(), " ")); Assert.That(result.ParamName, Is.EqualTo("validatingField")); }
public void ShouldBeFutureDateTime_WhenValidatingTypeIsNull_ThrowsArgumentNullException() { IDateTimeValidator sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.ShouldBeFutureDateTime(_fixture.Create <DateTime>(), null, _fixture.Create <string>())); Assert.That(result.ParamName, Is.EqualTo("validatingType")); }