private static TimeGuid GetTimeGuidFromRowKey([NotNull] string rowKey) { TimeGuid timeGuid; if (!TimeGuid.TryParse(rowKey, out timeGuid)) { throw new InvalidOperationException(string.Format("Invalid rowKey: {0}", rowKey)); } return(timeGuid); }
private static TimeGuid GetTimeGuidFromColumnName([NotNull] string columnName) { TimeGuid timeGuid; if (!TimeGuid.TryParse(columnName.Split('_')[1], out timeGuid)) { throw new InvalidOperationException(string.Format("Invalid regular column name: {0}", columnName)); } return(timeGuid); }
private static BlobId GetBlobId([NotNull] string taskId) { TimeGuid timeGuid; if (!TimeGuid.TryParse(taskId, out timeGuid)) { throw new InvalidOperationException(string.Format("Task is not time-based: {0}", taskId)); } return(new BlobId(timeGuid, BlobType.Regular)); }
public void TryParse() { Assert.That(TimeGuid.TryParse(null, out var actual), Is.False); Assert.That(actual, Is.Null); Assert.That(TimeGuid.TryParse("some-string", out actual), Is.False); Assert.That(actual, Is.Null); Assert.That(TimeGuid.TryParse(Guid.NewGuid().ToString(), out actual), Is.False); Assert.That(actual, Is.Null); var timeGuid = TimeGuid.NowGuid(); Assert.That(TimeGuid.TryParse(timeGuid.ToGuid().ToString(), out actual), Is.True); Assert.That(actual, Is.EqualTo(timeGuid)); }
internal bool IsTimeBased() { TimeGuid timeGuid; return(TimeGuid.TryParse(Id, out timeGuid)); }