public void FormatTimeSpanTests(string expected, string span) { var val = TimeSpan.Parse(span); var actual = DnsZoneUtils.FormatTimeSpan(val); Assert.AreEqual(expected, actual); }
public void ParseTimeSpanTests(string zoneStr, string spanStr) { var actual = DnsZoneUtils.ParseTimeSpan(zoneStr); var expected = TimeSpan.Parse(spanStr); Assert.AreEqual(expected, actual); }
public ResourceRecordType ReadResourceRecordType() { var token = Tokens.Dequeue(); if (token.Type != TokenType.Literal) { throw new TokenException("resource record type expected", token); } return(DnsZoneUtils.ParseResourceRecordType(token.StringValue)); }
public bool TryParseClass(out string @class) { @class = null; var token = Tokens.Peek(); if (token.Type != TokenType.Literal) { return(false); } if (DnsZoneUtils.TryParseClass(token.StringValue, out @class)) { Tokens.Dequeue(); return(true); } return(false); }
public bool TryParseTtl(out TimeSpan val) { val = TimeSpan.Zero; var token = Tokens.Peek(); if (token.Type != TokenType.Literal) { return(false); } if (DnsZoneUtils.TryParseTimeSpan(token.StringValue, out val)) { Tokens.Dequeue(); return(true); } return(false); }
public TimeSpan ReadTimeSpan() { var val = Tokens.Dequeue().StringValue; return(DnsZoneUtils.ParseTimeSpan(val)); }
public void WriteTimeSpan(TimeSpan val) { Sb.Append(DnsZoneUtils.FormatTimeSpan(val)); Sb.Append(TAB_CHAR); }
public void WriteResourceRecordType(ResourceRecordType val) { Sb.Append(DnsZoneUtils.FormatResourceRecordType(val)); Sb.Append(TAB_CHAR); }