public void it_should_insert_the_consumption_logs_into_the_store() { deleteConsumptionLogTable(); var subject = new TableEventStore(CloudStorageAccount.DevelopmentStorageAccount, "test"); var expectedEvent = new RaisedEvent( Guid.NewGuid(), new DummyEvent {Prop = "Property"}, new DateTimeOffset(2013, 01, 17, 12, 06, 39, 967, TimeZoneInfo.Utc.BaseUtcOffset), "txid"); var expectedConsumptionLog = new ConsumptionLog( expectedEvent, expectedEvent.RaisedTimestamp.AddSeconds(1), new AggregateInfo(typeof (DummyAggregate), 123)); subject.LogConsumption(expectedEvent, expectedConsumptionLog); var actual = storedConsumptionLogEntity(expectedConsumptionLog); actual.ShouldNotBeNull(); actual.ConsumedTimestamp.ShouldEqual(expectedConsumptionLog.ConsumedTimestamp); actual.ConsumptionException.ShouldEqual(expectedConsumptionLog.ConsumptionException); actual.Event.ShouldEqual(JsonEvent.ConvertToJson(expectedEvent)); actual.EventThumbprint.ShouldEqual(expectedConsumptionLog.EventThumbprint); }
public async void it_should_insert_the_event_into_the_store() { deleteEventStoreTable(); var subject = new TableEventStore(CloudStorageAccount.DevelopmentStorageAccount, "test"); var expected = new RaisedEvent( Guid.NewGuid(), new DummyEvent {Prop = "Property"}, new DateTimeOffset(2013, 01, 17, 12, 06, 39, 967, TimeZoneInfo.Utc.BaseUtcOffset), "txid"); var eventEntity = new EventEntity(expected); var insert = TableOperation.Insert(eventEntity); var inserted = Task.Factory.FromAsync<TableOperation, TableResult>(subject.EventStoreTable.BeginExecute, subject.EventStoreTable.EndExecute, insert, null); await inserted; var actual = storedEventEntity(expected); actual.ShouldNotBeNull(); actual.Event.ShouldEqual(JsonEvent.ConvertToJson(expected)); actual.RaisedTimestamp.ShouldEqual(expected.RaisedTimestamp); actual.TransactionId.ShouldEqual(expected.TransactionId); }