File: AzureMessagingEventHubsSettingsTests.cs
Web Access
Project: src\tests\Aspire.Azure.Messaging.EventHubs.Tests\Aspire.Azure.Messaging.EventHubs.Tests.csproj (Aspire.Azure.Messaging.EventHubs.Tests)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
using Microsoft.DotNet.RemoteExecutor;
using Xunit;
 
namespace Aspire.Azure.Messaging.EventHubs.Tests;
 
public class AzureMessagingEventHubsSettingsTests
{
    [Fact]
    public void TracingIsEnabledWhenAzureSwitchIsSet()
    {
        RemoteExecutor.Invoke(() => EnsureTracingIsEnabledWhenAzureSwitchIsSet(true)).Dispose();
        RemoteExecutor.Invoke(() => EnsureTracingIsEnabledWhenAzureSwitchIsSet(false), EnableTracingForAzureSdk()).Dispose();
    }
 
    private static void EnsureTracingIsEnabledWhenAzureSwitchIsSet(bool expectedValue)
    {
        // doesn't matter which concrete class we use, as the property is defined in the base class
        Assert.Equal(expectedValue, new AzureMessagingEventHubsConsumerSettings().DisableTracing);
    }
 
    private static RemoteInvokeOptions EnableTracingForAzureSdk()
        => new()
        {
            RuntimeConfigurationOptions = { { "Azure.Experimental.EnableActivitySource", true } }
        };
}