public given_an_empty_event_log() { this.tableName = "AzureEventLogFixture" + new Random((int)DateTime.Now.Ticks).Next(); var settings = InfrastructureSettings.Read("Settings.xml").EventSourcing; this.account = CloudStorageAccount.Parse(settings.ConnectionString); this.eventA = new EventA(); this.eventB = new EventB(); this.eventC = new EventC(); this.metadata = Mock.Of<IMetadataProvider>(x => x.GetMetadata(eventA) == new Dictionary<string, string> { { StandardMetadata.SourceId, eventA.SourceId.ToString() }, { StandardMetadata.SourceType, "SourceA" }, { StandardMetadata.Kind, StandardMetadata.EventKind }, { StandardMetadata.AssemblyName, "A" }, { StandardMetadata.Namespace, "Namespace" }, { StandardMetadata.FullName, "Namespace.EventA" }, { StandardMetadata.TypeName, "EventA" }, } && x.GetMetadata(eventB) == new Dictionary<string, string> { { StandardMetadata.SourceId, eventB.SourceId.ToString() }, { StandardMetadata.SourceType, "SourceB" }, { StandardMetadata.Kind, StandardMetadata.EventKind }, { StandardMetadata.AssemblyName, "B" }, { StandardMetadata.Namespace, "Namespace" }, { StandardMetadata.FullName, "Namespace.EventB" }, { StandardMetadata.TypeName, "EventB" }, } && x.GetMetadata(eventC) == new Dictionary<string, string> { { StandardMetadata.SourceId, eventC.SourceId.ToString() }, { StandardMetadata.SourceType, "SourceC" }, { StandardMetadata.Kind, StandardMetadata.EventKind }, { StandardMetadata.AssemblyName, "B" }, { StandardMetadata.Namespace, "AnotherNamespace" }, { StandardMetadata.FullName, "AnotherNamespace.EventC" }, { StandardMetadata.TypeName, "EventC" }, }); this.serializer = new JsonTextSerializer(); this.writer = new AzureMessageLogWriter(this.account, this.tableName); this.sut = new AzureEventLogReader(this.account, this.tableName, new JsonTextSerializer()); this.startEnqueueTime = new DateTime(2012, 06, 30, 23, 59, 0, DateTimeKind.Utc); Save(eventA, startEnqueueTime); Save(eventB, startEnqueueTime.AddMinutes(5)); Save(eventC, startEnqueueTime.AddMinutes(6)); }
public AzureMessageLogListener(AzureMessageLogWriter eventLog, IMessageReceiver receiver) { this.eventLog = eventLog; this.receiver = receiver; this.receiver.MessageReceived += SaveMessage; }