Hello from integration test.
", IsHtml = true, QueuedAt = DateTime.Now }; var depthBefore = await _publisher.GetQueueDepthAsync(); await _publisher.EnqueueAsync(email); await Task.Delay(300); var depthAfter = await _publisher.GetQueueDepthAsync(); Assert.True(depthAfter >= depthBefore + 1, $"Expected queue depth to increase by at least 1. Before: {depthBefore}, After: {depthAfter}."); } [Fact] public async Task EnqueueAsync_MultipleMessages_AllArrivesInQueue() { var emails = Enumerable.Range(1, 3).Select(i => new OutgoingEmailEvent { Id = Guid.NewGuid(), Recipient = $"recipient{i}@example.com", Subject = $"Integration Test - Batch #{i}", Body = $"Batch message {i}", IsHtml = false, QueuedAt = DateTime.Now }).ToList(); foreach (var email in emails) await _publisher.EnqueueAsync(email); await Task.Delay(500); // Verify at least one message is present var received = await PeekMessageAsync(); Assert.NotNull(received); } [Fact] public async Task GetQueueDepthAsync_AfterPublish_ReturnsPositiveDepth() { var email = new OutgoingEmailEvent { Id = Guid.NewGuid(), Recipient = "depth-test@example.com", Subject = "Integration Test - GetQueueDepth", Body = "Queue depth test", IsHtml = false, QueuedAt = DateTime.Now }; await _publisher.EnqueueAsync(email); await Task.Delay(300); var depth = await _publisher.GetQueueDepthAsync(); Assert.True(depth > 0, $"Expected queue depth > 0, but got {depth}."); } [Fact] public async Task EnqueueAsync_SerializesAllFields_DeserializesCorrectly() { var id = Guid.NewGuid(); var email = new OutgoingEmailEvent { Id = id, Recipient = "serialize@example.com", Subject = "Serialization Test", Body = "Bold", IsHtml = true, QueuedAt = DateTime.Now }; await _publisher.EnqueueAsync(email); await Task.Delay(300); // Read messages until we find the one we just published var received = await FindMessageAsync(id); Assert.NotNull(received); Assert.Equal(id, received.Id); Assert.Equal("serialize@example.com", received.Recipient); Assert.Equal("Serialization Test", received.Subject); Assert.Equal("Bold", received.Body); Assert.True(received.IsHtml); } ///