Пример #1
0
        /// <inheritdoc />
        public async Task <StoreResult> InsertWebHookAsync(string user, WebHook webHook)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }
            if (webHook == null)
            {
                throw new ArgumentNullException("webHook");
            }

            user = NormalizeKey(user);
            string id = NormalizeKey(webHook.Id);

            CloudTable         table       = _manager.GetCloudTable(_connectionString, WebHookTable);
            DynamicTableEntity tableEntity = ConvertFromWebHook(user, id, webHook);
            TableOperation     operation   = TableOperation.Insert(tableEntity, echoContent: false);
            TableResult        tableResult = await _manager.ExecuteAsync(table, operation);

            StoreResult result = GetStoreResult(tableResult);

            if (result != StoreResult.Success)
            {
                string msg = string.Format(CultureInfo.CurrentCulture, AzureStorageResources.StorageManager_CreateFailed, table.Name, tableResult.HttpStatusCode);
                _logger.Error(msg);
            }
            return(result);
        }
Пример #2
0
        public async Task Execute_ReturnsStatus_IfError()
        {
            // Arrange
            CloudTable table = InitializeTable();

            await CreateTableRows(table);

            ITableEntity   entity    = new DynamicTableEntity(TestPartition, "data 0");
            TableOperation operation = TableOperation.Insert(entity);

            // Act
            TableResult actual = await _manager.ExecuteAsync(table, operation);

            // Assert
            Assert.Equal(409, actual.HttpStatusCode);
        }