Пример #1
0
        public void AddPartitionKeyConstraint_CreatesExpectedQuery(string filter, string partitionKey, string expected)
        {
            // Arrange
            TableQuery actual = new TableQuery {
                FilterString = filter
            };

            // Act
            _manager.AddPartitionKeyConstraint(actual, partitionKey);

            // Assert
            Assert.Equal(expected, actual.FilterString);
        }
Пример #2
0
        /// <inheritdoc />
        public override async Task <ICollection <WebHook> > GetAllWebHooksAsync(string user)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            user = NormalizeKey(user);

            CloudTable table = _manager.GetCloudTable(_connectionString, WebHookTable);
            TableQuery query = new TableQuery();

            _manager.AddPartitionKeyConstraint(query, user);

            IEnumerable <DynamicTableEntity> entities = await _manager.ExecuteQueryAsync(table, query);

            ICollection <WebHook> result = entities.Select(e => ConvertToWebHook(e))
                                           .Where(w => w != null)
                                           .ToArray();

            return(result);
        }