Repository: microsoft/semantic-kernel
File: dotnet/src/Connectors/Connectors.MistralAI.UnitTests/MistralAIExtensionTests.cs (C#)

Code before:
        var service = kernel.GetRequiredService<IChatCompletionService>();

        // Assert
        Assert.NotNull(service);
        Assert.IsType<MistralAIChatCompletionService>(service);
    }

    [Fact]
    public void AddMistralTextEmbeddingGenerationToKernelBuilder()
    {
        // Arrange
        var collection = new ServiceCollection();
        var kernelBuilder = collection.AddKernel();
        kernelBuilder.AddMistralTextEmbeddingGeneration("model", "apiKey");

        // Act
        var kernel = collection.BuildServiceProvider().GetRequiredService<Kernel>();
        var service = kernel.GetRequiredService<ITextEmbeddingGenerationService>();

        // Assert
        Assert.NotNull(service);
        Assert.IsType<MistralAITextEmbeddingGenerationService>(service);
    }

    [Fact]
    public void AddMistralChatCompletionInjectsExtraParametersHeader()
    {
        // Arrange
        using var handler = new HttpClientHandler();
        using var httpClient = new HttpClient(handler);
        var collection = new ServiceCollection();
        var kernelBuilder = collection.AddKernel();

        kernelBuilder.AddMistralChatCompletion(
            modelId: "model",
            apiKey: "key",
            endpoint: new Uri("https://example.com"),
            httpClient: httpClient);

        // Act
        var kernel = collection.BuildServiceProvider().GetRequiredService<Kernel>();
        var service = kernel.GetRequiredService<IChatCompletionService>();

        // Assert
        Assert.NotNull(service);
        Assert.IsType<MistralAIChatCompletionService>(service);
        Assert.True(httpClient.DefaultRequestHeaders.Contains("extra-parameters"));
        var headerValues = httpClient.DefaultRequestHeaders.GetValues("extra-parameters");
        Assert.Contains("pass-through", headerValues);
    }
}

Review comment (bug):
You will need to modify this test, because as your are now passing an httpClient it will fail, (it wont modify a provided one).

Suggestion would be to use reflection to capture the 

mistralService.Client._httpClient and see if it's default headers are set.

https://github.com/microsoft/semantic-kernel/blob/034cf6f21bd495a3379f95f2d99ae9056d3543bc/dotnet/src/Connectors/Connectors.MistralAI/Client/MistralClient.cs#L44

Code after:
        var kernel = collection.BuildServiceProvider().GetRequiredService<Kernel>();
        var service = kernel.GetRequiredService<IChatCompletionService>();

        // Assert
        Assert.NotNull(service);
        Assert.IsType<MistralAIChatCompletionService>(service);
    }

    [Fact]
    public void AddMistralTextEmbeddingGenerationToKernelBuilder()
    {
        // Arrange
        var collection = new ServiceCollection();
        var kernelBuilder = collection.AddKernel();
        kernelBuilder.AddMistralTextEmbeddingGeneration("model", "apiKey");

        // Act
        var kernel = collection.BuildServiceProvider().GetRequiredService<Kernel>();
        var service = kernel.GetRequiredService<ITextEmbeddingGenerationService>();

        // Assert
        Assert.NotNull(service);
        Assert.IsType<MistralAITextEmbeddingGenerationService>(service);
    }

    [Theory]
    [InlineData(true)]
    [InlineData(false)]
    public void AddMistralChatCompletionInjectsExtraParametersHeader(bool useServiceCollection)
    {
        // Arrange
        var collection = new ServiceCollection();
        var kernelBuilder = collection.AddKernel();

        if (useServiceCollection)
        {
            // Use the service collection to add the Mistral chat completion
            kernelBuilder.Services.AddMistralChatCompletion(
                modelId: "model",
                apiKey: "key",
                endpoint: new Uri("https://example.com"));
        }
        else
        {
            // Use the kernel builder directly
            kernelBuilder.AddMistralChatCompletion(
                modelId: "model",
                apiKey: "key",
                endpoint: new Uri("https://example.com"));
        }