Skip to content

Commit

Permalink
docs: fix testing code snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
BEagle1984 committed Jun 28, 2021
1 parent ca2c6b0 commit b266d5c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/concepts/broker/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class KafkaTests
// Register Silverback as usual
.AddSilverback()
// Register the mocked KafkaBroker
.WithConnectionTo(config => config.AddMockedKafka())
.WithConnectionToMessageBroker(config => config.AddMockedKafka())
// Configure inbound and outbound endpoints
.AddKafkaEndpoints(endpoints => endpoints
.Configure(config =>
Expand All @@ -56,21 +56,21 @@ public class KafkaTests
}

[Fact]
public void SampleTest()
public async Task SampleTest()
{
// Arrange
// Connect the broker
_serviceProvider.GetRequiredService<IBroker>().Connect();
await _serviceProvider.GetRequiredService<IBroker>().ConnectAsync();

// Create a producer to push to test-topic
var producer = _serviceProvider
.GetRequiredService<IBroker>()
.GetProducer(new KafkaProducerEndpoint("test-topic"));

// Act
producer.Produce(new TestMessage { Content = "hello!" });
producer.Produce(new TestMessage { Content = "hello 2!" });
await producer.ProduceAsync(new TestMessage { Content = "hello!" });
await producer.ProduceAsync(new TestMessage { Content = "hello 2!" });

// Assert
// ...your assertions...
Expand Down

0 comments on commit b266d5c

Please sign in to comment.