public async Task WhenABatchLoggerWritesToTheSinkItStoresAllTheEntriesInDifferentPartitions() { var storageAccount = CloudStorageAccount.DevelopmentStorageAccount; var tableClient = storageAccount.CreateCloudTableClient(); var table = tableClient.GetTableReference("LogEventEntity"); await table.DeleteIfExistsAsync(); using (var sink = new AzureBatchingTableStorageWithPropertiesSink(storageAccount, null, 1000, TimeSpan.FromMinutes(1))) { var messageTemplate = "Some text"; var template = new MessageTemplateParser().Parse(messageTemplate); var properties = new List <LogEventProperty>(); for (int k = 0; k < 4; ++k) { var timestamp = new DateTimeOffset(2014, 12, 01, 1 + k, 42, 20, 666, TimeSpan.FromHours(2)); for (int i = 0; i < 2; ++i) { sink.Emit(new Events.LogEvent(timestamp, LogEventLevel.Information, null, template, properties)); } } } var result = await TableQueryTakeDynamicAsync(table, takeCount : 9); Assert.Equal(8, result.Count); }
public void WhenABatchLoggerWritesToTheSinkItStoresAllTheEntriesInLargeNumber() { var storageAccount = CloudStorageAccount.DevelopmentStorageAccount; var tableClient = storageAccount.CreateCloudTableClient(); var table = tableClient.GetTableReference("LogEventEntity"); table.DeleteIfExists(); using (var sink = new AzureBatchingTableStorageWithPropertiesSink(storageAccount, null, 1000, TimeSpan.FromMinutes(1))) { var timestamp = new DateTimeOffset(2014, 12, 01, 18, 42, 20, 666, TimeSpan.FromHours(2)); var messageTemplate = "Some text"; var template = new MessageTemplateParser().Parse(messageTemplate); var properties = new List <LogEventProperty>(); for (int i = 0; i < 300; ++i) { sink.Emit(new Events.LogEvent(timestamp, LogEventLevel.Information, null, template, properties)); } } var result = table.ExecuteQuery(new TableQuery()); Assert.AreEqual(300, result.Count()); }
public void WhenABatchLoggerWritesToTheSinkItStoresAllTheEntriesInLargeNumber() { var storageAccount = CloudStorageAccount.DevelopmentStorageAccount; var tableClient = storageAccount.CreateCloudTableClient(); var table = tableClient.GetTableReference("LogEventEntity"); table.DeleteIfExists(); using (var sink = new AzureBatchingTableStorageWithPropertiesSink(storageAccount, null, 1000, TimeSpan.FromMinutes(1))) { var timestamp = new DateTimeOffset(2014, 12, 01, 18, 42, 20, 666, TimeSpan.FromHours(2)); var messageTemplate = "Some text"; var template = new MessageTemplateParser().Parse(messageTemplate); var properties = new List<LogEventProperty>(); for (int i = 0; i < 300; ++i) { sink.Emit(new Events.LogEvent(timestamp, LogEventLevel.Information, null, template, properties)); } } var result = table.ExecuteQuery(new TableQuery()); Assert.AreEqual(300, result.Count()); }