public void MustThrowFormatExceptionWhenInputIsInWrongFormat(string source) { LocalTimeConverter converter = null; try { converter = new LocalTimeConverter(); } catch { Assert.Inconclusive(); } Assert.That(() => converter.Convert(source, new LocalTime(), null), Throws.InstanceOf <FormatException>()); }
public void MustThrowArgumentOutOfRangeExceptionWhenTimeIsOutOfRange(string source) { LocalTimeConverter converter = null; try { converter = new LocalTimeConverter(); } catch { Assert.Inconclusive(); } Assert.That(() => converter.Convert(source, new LocalTime(), null), Throws.InstanceOf <ArgumentOutOfRangeException>()); }
public void ShouldParseDateTimeStringProperly(string source, int hours, int minutes, int seconds) { LocalTimeConverter converter = null; try { converter = new LocalTimeConverter(); } catch { Assert.Inconclusive(); } var localTime = converter.Convert(source, new LocalTime(), null); Assert.That(localTime.Hour, Is.EqualTo(hours)); Assert.That(localTime.Minute, Is.EqualTo(minutes)); Assert.That(localTime.Second, Is.EqualTo(seconds)); }
public void ShouldThrowExceptionWhenSourceIsNullOrWhiteSpace(string source) { var converter = new LocalTimeConverter(); Assert.That(() => converter.Convert(source, new LocalTime(), null), Throws.InstanceOf <ArgumentOutOfRangeException>()); }