public async Task WhenReadingRangeFromTable_ReturnElementsWithinAFiveMinuteTimespan()
        {
            var token  = _table.GetSharedAccessSignature(null, QueryPolicyName);
            var sut    = new Reader.AzureStorageTableRangeReader(AccountName, token);
            var actual = (await sut.ReadRangeAsync(TableName, PartitionName, StartTime).ConfigureAwait(false));

            Assert.All(actual, s => Assert.True(s.At <= StartTime.AddMinutes(5)));
        }
 public async Task WhenReadingRangeFromTableWithoutAccess_ThrowsAnException()
 {
     var token = _table.GetSharedAccessSignature(null, InsertPolicyName);
     var sut   = new Reader.AzureStorageTableRangeReader(AccountName, token);
     await Assert.ThrowsAsync <StorageException>(
         () => sut.ReadRangeAsync(TableName, PartitionName, StartTime)
         .ContinueWith(t => t.Result.ToList()))
     .ConfigureAwait(false);
 }
        public async Task WhenReadingRangeFromTableWithoutAccess_ReturnsEmptyEnumerable()
        {
            var startTime = StartTime.AddMinutes(10);
            var token     = _table.GetSharedAccessSignature(
                null,
                QueryPolicyName,
                PartitionName,
                startTime.ToUnixTime(),
                PartitionName,
                startTime.AddMinutes(5).ToUnixTime());
            var sut    = new Reader.AzureStorageTableRangeReader(AccountName, token);
            var actual = await sut.ReadRangeAsync(TableName, PartitionName, StartTime).ConfigureAwait(false);

            Assert.Empty(actual);
        }
        public async Task WhenReadingRangeFromTableWithPartialAccess_ReturnOnlyQueryableRows()
        {
            var endTime   = StartTime.AddMinutes(5);
            var startTime = endTime.Subtract(TimeSpan.FromSeconds(30));
            var token     = _table.GetSharedAccessSignature(
                null,
                QueryPolicyName,
                PartitionName,
                startTime.ToUnixTime(),
                PartitionName,
                endTime.ToUnixTime());
            var sut    = new Reader.AzureStorageTableRangeReader(AccountName, token);
            var actual = await sut.ReadRangeAsync(TableName, PartitionName, StartTime).ConfigureAwait(false);

            Assert.All(actual, s => Assert.True(s.At >= startTime && s.At <= endTime));
        }