コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        internal bool IsTimeBased()
        {
            TimeGuid timeGuid;

            return(TimeGuid.TryParse(Id, out timeGuid));
        }