automated-testing-demo/integration-test/IntegrationTests.cs

38 lines
950 B
C#
Raw Normal View History

using DotNet.Testcontainers.Builders;
using Testcontainers.Kafka;
using Testcontainers.MongoDb;
namespace integration_test;
public sealed class UnitTest1 : IAsyncLifetime
{
private readonly MongoDbContainer _mongoDbContainer = new MongoDbBuilder().Build();
private readonly KafkaContainer _kafkaContainer = new KafkaBuilder().WithImage("confluentinc/cp-kafka:latest").Build();
public Task DisposeAsync()
{
Task[] tasks = new Task[]
{
_mongoDbContainer.DisposeAsync().AsTask(),
_kafkaContainer.DisposeAsync().AsTask()
};
return Task.WhenAll(tasks);
}
public Task InitializeAsync()
{
Task[] tasks = new Task[] {
_mongoDbContainer.StartAsync(),
_kafkaContainer.StartAsync()
};
return Task.WhenAll(tasks);
}
[Fact]
public void ShouldProcessMessage()
{
}
}