public void SimpleConfiguration_ConnectionStringIsNull_ThrowsArgumentException() { // Act and Assert Should.Throw <ArgumentException>(() => { TableStorageProvider.Configure((string)null); }); }
public HttpResponseMessage Get() { TableStorageProvider tableStorageProvider = new TableStorageProvider(); var charData = tableStorageProvider.GetChartData(); var response = Request.CreateResponse(HttpStatusCode.OK, charData); return(response); }
public void FullConfiguration_ConfigIsNull_ThrowsAgurmentNullException() { // Act and Assert Should.Throw <ArgumentNullException>(() => { TableStorageProvider.Configure((TableStorageConfiguration)null); }); }
public void TestInitialize() { _tableStorageProvider = new AzureTableStorageProvider( _storageAccount ); _tableName = _baseTableName + Guid.NewGuid().ToString().Replace( "-", string.Empty ); var client = new CloudTableClient( new Uri( _storageAccount.TableEndpoint ), _storageAccount.Credentials ); client.GetTableReference( _tableName ).CreateAsync().Wait(); }
public void SimpleConfiguration_ValidConnectionStringToggleDoesNotExist_ThrowsToggleConfigurationError() { // Arrange TableStorageProvider.Configure(TestConfig.ValidConnectionString); // Act and Assert Should.Throw <ToggleConfigurationError>(() => { var toggleValue = sut.EvaluateBooleanToggleValue(new TestFeatureToggle()); }); }
public void TestInitialize() { _tableStorageProvider = new AzureTableStorageProvider(_storageAccount); _tableName = _baseTableName + Guid.NewGuid().ToString().Replace("-", string.Empty); var client = new CloudTableClient(new Uri(_storageAccount.TableEndpoint), _storageAccount.Credentials); client.GetTableReference(_tableName).CreateAsync().Wait(); }
protected void ConfigureProvider(bool autoCreateTable = false, bool autoCreateToggle = false) { var config = new TableStorageConfiguration { ConnectionString = "UseDevelopmentStorage=true" }; config.AutoCreateTable = autoCreateTable; config.AutoCreateFeature = autoCreateToggle; config.TableName = tableName; TableStorageProvider.Configure(config); }
public HttpResponseMessage Post([FromBody] SensorReading sensorReading) { TableStorageProvider <SensorReadingEntry> storageProvider = new TableStorageProvider <SensorReadingEntry>("SensorData"); SensorReadingEntry sre = new SensorReadingEntry(); sre.RowKey = sensorReading.SensorName; sre.Value = sensorReading.Value; sre.UtcTicks = DateTime.UtcNow.Ticks; storageProvider.Insert(sre); return(Request.CreateResponse <SensorReading>(HttpStatusCode.OK, sensorReading)); }
public async Task <ClaimTableEntity> ProcessAsync(ClaimForm claim) { var table = await TableStoreFactory.CreateAsync(this.connectionString, this.tableName); var provider = new TableStorageProvider(table); TableOperation retrieveOperation = TableOperation.Retrieve <ClaimTableEntity>(claim.Id.ToString(), claim.Id.ToString()); var result = await provider.QuerySingleAsync(retrieveOperation); var target = result.Result as ClaimTableEntity; return(target); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //TableStorageProvider.Configure("UseDevelopmentStorage=true"); TableStorageProvider.Configure(new TableStorageConfiguration { ConnectionString = "UseDevelopmentStorage=true", AutoCreateFeature = true, AutoCreateTable = true }); //DocumentDbProvider.Configure("https://localhost:8081", "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="); DocumentDbProvider.Configure(new DocumentDbConfiguration { ServiceEndpoint = "https://localhost:8081", AuthKey = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==", AutoCreateDatabaseAndCollection = true, AutoCreateFeature = true }); }
public void Update_ItemExistsAndUpdateIsValid_ShouldPerformTheUpdate() { EnsureOneItemInTableStorage(); var itemToUpdate = _tableStorageProvider.Get<TypeWithStringProperty>( _tableName, _partitionKey, _rowKey ); string updatedFirstTypeValue = "I am updated"; itemToUpdate.FirstType = updatedFirstTypeValue; _tableStorageProvider = new AzureTableStorageProvider( _storageAccount ); _tableStorageProvider.Update( _tableName, itemToUpdate, _partitionKey, _rowKey ); _tableStorageProvider.Save(); var updatedItem = _tableStorageProvider.Get<TypeWithStringProperty>( _tableName, _partitionKey, _rowKey ); Assert.AreEqual( updatedFirstTypeValue, updatedItem.FirstType ); }
public void Upsert_ItemExistsAndIsThenUpdated_ItemIsProperlyUpdated() { var itemToUpsert = new TypeWithStringProperty { FirstType = "first" }; _tableStorageProvider.Upsert( _tableName, itemToUpsert, _partitionKey, _rowKey ); _tableStorageProvider.Save(); _tableStorageProvider = new AzureTableStorageProvider( _storageAccount ); itemToUpsert = new TypeWithStringProperty { FirstType = "second" }; _tableStorageProvider.Upsert( _tableName, itemToUpsert, _partitionKey, _rowKey ); _tableStorageProvider.Save(); var itemInTable = _tableStorageProvider.Get<TypeWithStringProperty>( _tableName, _partitionKey, _rowKey ); Assert.AreEqual( itemToUpsert.FirstType, itemInTable.FirstType ); }
public void SetUp() { InMemoryTableStorageProvider.ResetAllTables(); _tableStorageProvider = new InMemoryTableStorageProvider(); _tableStorageProvider.ShouldThrowForReservedPropertyNames = false; }
public void TestInitialize() { _storageAccount = new ConnectionStringCloudStorageAccount( ConfigurationManager.AppSettings["storageConnectionString"] ); _tableStorageProvider = new AzureTableStorageProvider( _storageAccount ); _client = new CloudTableClient( _storageAccount.TableEndpoint, _storageAccount.Credentials ); _tableName = _baseTableName + Guid.NewGuid().ToString().Replace( "-", string.Empty ); _client.CreateTable( _tableName ); }
public HashRepository( TableStorageProvider tableStorageProvider ) { _tableStorageProvider = tableStorageProvider; }
public HttpResponseMessage Get(int noOfValues) { TableStorageProvider <SensorReadingEntry> storageProvider = new TableStorageProvider <SensorReadingEntry>("SensorData"); return(Request.CreateResponse <IEnumerable <SensorReadingEntry> >(HttpStatusCode.OK, storageProvider.GetLastValues(100).ToArray())); }
public void SetUp() { InMemoryTableStorageProvider.ResetAllTables(); _tableStorageProvider = new InMemoryTableStorageProvider(); }
private void EnsureItemsInContext( TableStorageProvider tableStorageProvider, int count ) { for ( int i = 0; i < count; i++ ) { var item = new SimpleDataItem { FirstType = i.ToString( CultureInfo.InvariantCulture ), SecondType = i }; tableStorageProvider.Add( _tableName, item, _partitionKey, _rowKey + i ); } tableStorageProvider.Save(); }
public HashRepository(TableStorageProvider tableStorageProvider) { _tableStorageProvider = tableStorageProvider; }
public void Setup() { sut = new TableStorageProvider(); }
private void EnsureOneItemInContext( TableStorageProvider tableStorageProvider ) { var item = new SimpleDataItem { FirstType = "First", SecondType = 2 }; tableStorageProvider.Add( _tableName, item, _partitionKey, _rowKey ); tableStorageProvider.Save(); }
/// <summary> /// Creates a new ITableStorageClient instance based on the /// passed-in provider. /// </summary> /// <typeparam name="TElement">The type of table entity.</typeparam> /// <param name="config">Configuration to access the Table Storage. /// </param> /// <param name="provider">Defines the provider used to build the /// instance. By default it is set to Azure Table Storage.</param> /// <returns>ITableStorageClient instance based on the passed-in /// provider.</returns> public static ITableStorageClient <TElement> Create <TElement>( TableStorageConfig config, TableStorageProvider provider = TableStorageProvider.Azure) where TElement : ITableEntity, new() => provider switch {
private ImageProcessingService() { this.emotionProvider = new EmotionProvider(); this.tableStorageProvider = new TableStorageProvider(); this.reactor = new ImageReactor(); }
protected TableStorageToggle() { ToggleValueProvider = new TableStorageProvider(); }