Skip to content
Tracon

ModelProviderSettingsContract

Namespace Tracon.Testing.Contracts.Providers · Assembly Tracon.Testing.Contracts.Xunit.dll

Behavior tests for a provider that validates ModelBinding.ProviderSettings.

public abstract class ModelProviderSettingsContract : ModelProviderContract, IAsyncLifetime, IAsyncDisposable

objectModelProviderContractModelProviderSettingsContract

IAsyncLifetime, IAsyncDisposable

ModelProviderContract.CreateProviderAsync(), ModelProviderContract.InitializeAsync(), ModelProviderContract.DisposeAsync(), ModelProviderContract.OnDisposeAsync(), ModelProviderContract.Binding(string?, string?), ModelProviderContract.Provider_name_is_not_empty(), ModelProviderContract.Catalog_model_names_are_unique_and_not_empty(), ModelProviderContract.Create_chat_client_returns_a_client_for_the_setup_time_credential(), ModelProviderContract.Create_chat_client_returns_a_raw_client_that_builds_no_tool_call_loop(), ModelProviderContract.Create_chat_client_accepts_a_binding_whose_provider_name_differs_in_case(), ModelProviderContract.A_model_the_catalog_does_not_list_is_not_rejected(), ModelProviderContract.Concurrent_create_chat_client_calls_all_return_a_client(), ModelProviderContract.A_client_that_is_never_disposed_does_not_stop_the_provider(), ModelProviderContract.Provider, ModelProviderContract.UnknownModelName, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Reading provider settings is optional: a provider that offers no tunable of its own reads none, and derives neither this class nor anything else. Deriving it states that the provider does read them and therefore owes the one rule Tracon fixes for all of them — an unknown key is not ignored silently. A setting that quietly does nothing makes the host author miss the behavior they configured without ever seeing why, which is the same reasoning that makes an unparsable ModelBinding.ReasoningEffort stop compilation instead of falling back to a default.

ModelProviderSettings.Validate in Tracon.Abstractions implements this rule, including the prefix convention (anthropic.*, google.*) that keeps one provider from silently accepting another’s keys. A provider is free to hand-roll the check as long as the observable behavior below holds.

protected ModelProviderSettingsContract()

A provider setting key this provider supports, with a value it accepts. Proves the rejection below is about the key being unknown, not about settings being rejected wholesale.

protected abstract KeyValuePair<string, JsonElement> SupportedSetting { get; }

KeyValuePair<string, JsonElement>

A setting key this provider does not support. Defaults to a key under this provider’s own prefix that no provider could plausibly define.

protected virtual string UnsupportedSettingKey { get; }

string

A_supported_provider_setting_is_accepted()

Section titled “ A_supported_provider_setting_is_accepted()”
[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/Providers/ModelProviderSettingsContract.cs", 59)]
public void A_supported_provider_setting_is_accepted()

A_supported_setting_is_matched_regardless_of_key_casing()

Section titled “ A_supported_setting_is_matched_regardless_of_key_casing()”
[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/Providers/ModelProviderSettingsContract.cs", 81)]
public void A_supported_setting_is_matched_regardless_of_key_casing()

Keys arrive with the default (ordinal) comparer when the binding is read back from a jsonb column, so a provider must not rely on the dictionary’s own comparer to match its keys case-insensitively.

An_unsupported_provider_setting_is_rejected()

Section titled “ An_unsupported_provider_setting_is_rejected()”
[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/Providers/ModelProviderSettingsContract.cs", 63)]
public void An_unsupported_provider_setting_is_rejected()