public void ConvertFrom() { TimeSpanConverter tsc = new TimeSpanConverter(); object timeSpan = tsc.ConvertFrom("1000"); Assert.IsNotNull(timeSpan); Assert.IsTrue(timeSpan is TimeSpan); Assert.AreEqual(TimeSpan.Parse("1000"), (TimeSpan)timeSpan); }
public void BaseConvertFrom() { TimeSpanConverter tsc = new TimeSpanConverter(); object timeSpan = tsc.ConvertFrom("00:00:10"); Assert.IsNotNull(timeSpan); Assert.IsTrue(timeSpan is TimeSpan); Assert.AreEqual(TimeSpan.FromSeconds(10), (TimeSpan)timeSpan); }
public void ConvertFromStringWithMilliSecondSpecifier() { TimeSpanConverter tsc = new TimeSpanConverter(); object timeSpan = tsc.ConvertFrom("100ms"); Assert.IsNotNull(timeSpan); Assert.IsTrue(timeSpan is TimeSpan); Assert.AreEqual(TimeSpan.FromMilliseconds(100), (TimeSpan)timeSpan); }
public void BaseConvertFrom() { TimeSpanConverter tsc = new TimeSpanConverter(); object timeSpan = tsc.ConvertFrom("00:00:10"); Assert.IsNotNull(timeSpan); Assert.IsTrue(timeSpan is TimeSpan); Assert.AreEqual(TimeSpan.FromSeconds(10), (TimeSpan)timeSpan); }
public void ConvertFromStringWithSecondSpecifier() { TimeSpanConverter tsc = new TimeSpanConverter(); object timeSpan = tsc.ConvertFrom("10s"); Assert.IsNotNull(timeSpan); Assert.IsTrue(timeSpan is TimeSpan); Assert.AreEqual(TimeSpan.FromSeconds(10), (TimeSpan)timeSpan); }
public void ConvertFrom() { TimeSpanConverter tsc = new TimeSpanConverter(); object timeSpan = tsc.ConvertFrom("1000"); Assert.IsNotNull(timeSpan); Assert.IsTrue(timeSpan is TimeSpan); Assert.AreEqual(TimeSpan.Parse("1000"), (TimeSpan)timeSpan); }
public void ConvertFromStringWithMinuteSpecifier() { TimeSpanConverter tsc = new TimeSpanConverter(); object timeSpan = tsc.ConvertFrom("2m"); Assert.IsNotNull(timeSpan); Assert.IsTrue(timeSpan is TimeSpan); Assert.AreEqual(TimeSpan.FromMinutes(2), (TimeSpan)timeSpan); }
public void ConvertFromStringWithHourSpecifier() { TimeSpanConverter tsc = new TimeSpanConverter(); object timeSpan = tsc.ConvertFrom("1H"); Assert.IsNotNull(timeSpan); Assert.IsTrue(timeSpan is TimeSpan); Assert.AreEqual(TimeSpan.FromHours(1), (TimeSpan)timeSpan); tsc.ConvertFrom("1h"); Assert.IsNotNull(timeSpan); Assert.IsTrue(timeSpan is TimeSpan); Assert.AreEqual(TimeSpan.FromHours(1), (TimeSpan)timeSpan); }
/// <summary> /// Registers standard and configured type converters. /// </summary> static TypeConverterRegistry() { lock (syncRoot) { converters[typeof(string[])] = new StringArrayConverter(); converters[typeof(Type)] = new RuntimeTypeConverter(); converters[typeof(Color)] = new RGBColorConverter(); converters[typeof(Uri)] = new UriConverter(); converters[typeof(FileInfo)] = new FileInfoConverter(); converters[typeof(NameValueCollection)] = new NameValueConverter(); converters[typeof(ResourceManager)] = new ResourceManagerConverter(); converters[typeof(Regex)] = new RegexConverter(); converters[typeof(TimeSpan)] = new TimeSpanConverter(); converters[typeof(ICredentials)] = new CredentialConverter(); converters[typeof(NetworkCredential)] = new CredentialConverter(); // register user-defined type converters } }
public void ConvertFromStringWithMinuteSpecifier() { TimeSpanConverter tsc = new TimeSpanConverter(); object timeSpan = tsc.ConvertFrom("2m"); Assert.IsNotNull(timeSpan); Assert.IsTrue(timeSpan is TimeSpan); Assert.AreEqual(TimeSpan.FromMinutes(2), (TimeSpan)timeSpan); }
public void ConvertFromNonSupportedOptionBails() { TimeSpanConverter tsc = new TimeSpanConverter(); tsc.ConvertFrom(12); }
public void ConvertFromNonSupportedOptionBails() { TimeSpanConverter tsc = new TimeSpanConverter(); tsc.ConvertFrom(12); }
public void ConvertFromNullReference() { TimeSpanConverter tsc = new TimeSpanConverter(); tsc.ConvertFrom(null); }
public void ConvertFromStringMalformed() { TimeSpanConverter tsc = new TimeSpanConverter(); Assert.Throws<FormatException>(() => tsc.ConvertFrom("15a")); }
public void ConvertFromStringMalformed() { TimeSpanConverter tsc = new TimeSpanConverter(); tsc.ConvertFrom("15a"); }
public void ConvertFromNullReference() { TimeSpanConverter tsc = new TimeSpanConverter(); Assert.Throws<NotSupportedException>(() => tsc.ConvertFrom(null)); }
public void ConvertFromNonSupportedOptionBails() { TimeSpanConverter tsc = new TimeSpanConverter(); Assert.Throws<NotSupportedException>(() => tsc.ConvertFrom(12)); }
static RetryAdvice() { log = LogManager.GetLogger(typeof(RetryAdvice)); timeSpanConverter = new TimeSpanConverter(); }
public void ConvertFromStringWithDaySpecifier() { TimeSpanConverter tsc = new TimeSpanConverter(); object timeSpan = tsc.ConvertFrom("1d"); Assert.IsNotNull(timeSpan); Assert.IsTrue(timeSpan is TimeSpan); Assert.AreEqual(TimeSpan.FromDays(1), (TimeSpan)timeSpan); }
public void ConvertFromStringMalformed() { TimeSpanConverter tsc = new TimeSpanConverter(); tsc.ConvertFrom("15a"); }
public void ConvertFromNullReference() { TimeSpanConverter tsc = new TimeSpanConverter(); Assert.Throws <NotSupportedException>(() => tsc.ConvertFrom(null)); }
public void ConvertFromNullReference() { TimeSpanConverter tsc = new TimeSpanConverter(); tsc.ConvertFrom(null); }
public void ConvertFromNonSupportedOptionBails() { TimeSpanConverter tsc = new TimeSpanConverter(); Assert.Throws <NotSupportedException>(() => tsc.ConvertFrom(12)); }
public void ConvertFromStringMalformed() { TimeSpanConverter tsc = new TimeSpanConverter(); Assert.Throws <FormatException>(() => tsc.ConvertFrom("15a")); }