public void GetRowKey_returns_combination_of_prefix_and_correlation_id() { var correlationId = Guid.NewGuid(); string actual = CorrelationTableEntity.GetRowKey(correlationId); actual.Should().Be($"{CorrelationTableEntity.RowKeyPrefix}-{correlationId:n}"); }
public async Task SaveEvents_inserts_CorrelationTableEntity_correctly() { // Arrange var created = fixture.Create <FakeUserCreated>(); var events = new DomainEvent[] { created }; var correlationId = Guid.NewGuid(); RaiseEvents(userId, events); // Act var now = DateTimeOffset.Now; await sut.SaveEvents <FakeUser>(events, correlationId); // Assert string partitionKey = CorrelationTableEntity.GetPartitionKey(typeof(FakeUser), userId); string rowKey = CorrelationTableEntity.GetRowKey(correlationId); var query = new TableQuery <CorrelationTableEntity>().Where($"PartitionKey eq '{partitionKey}' and RowKey eq '{rowKey}'"); IEnumerable <CorrelationTableEntity> correlations = s_eventTable.ExecuteQuery(query); correlations.Should() .ContainSingle(e => e.CorrelationId == correlationId) .Which.HandledAt.ToLocalTime().Should().BeCloseTo(now, 1000); }