in Sample-Code-Snippets/NET/ServiceBus.Emulator.TestContainers.Sample/ServiceBus.Emulator.TestContainers.Sample/TestContainerIntegrationExample.cs [13:45]
public async Task Setup()
{
//Sample Emulator Config; can be generated dynamically based on the test requirements, complex configs alternatively can also be read from a file
string emulatorConfig = $@"{{
""UserConfig"": {{
""Namespaces"": [
{{
""Name"": ""sbemulatorns"",
""Queues"": [
{{
""Name"": ""{_testQueue}"",
}}
]
}}
],
""Logging"": {{
""Type"":""File""
}}
}}
}}";
//Write the emulator config to a temp file to be mounted in the container as Config.json
var emulatorConfigFilePath = Path.GetTempFileName();
File.WriteAllText(emulatorConfigFilePath, emulatorConfig);
//When running the following tests you are accepting SB Emulator EULA : https://github.com/Azure/azure-service-bus-emulator-installer/blob/main/EMULATOR_EULA.txt
_serviceBusEmulatorContainer = new ServiceBusBuilder()
.WithBindMount(emulatorConfigFilePath, "/ServiceBus_Emulator/ConfigFiles/Config.json")
.WithAcceptLicenseAgreement(true)
.Build();
await _serviceBusEmulatorContainer.StartAsync();
}