Turned getter-like extension methods into extension properties (#1157)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-04 13:00:56 +01:00
1 parent 0375318b1b
commit f649febf88
286 files changed
+1379 -1109

No files matched your search

+3 -3
View File
@@ -19,7 +19,7 @@ public sealed class ImageSizeLimitTests
{
using (Assert.EnterMultipleScope())
{
Assert.That(LLMProviders.ANTHROPIC.GetMaxImageSizeBytes(), Is.EqualTo(3_932_160));
Assert.That(LLMProviders.ANTHROPIC.MaxImageSizeBytes, Is.EqualTo(3_932_160));
Assert.That(IImageSourceExtensions.MaxImageSizeBytesFor(ProviderOf(LLMProviders.ANTHROPIC)), Is.EqualTo(3_932_160));
}
}
@@ -29,7 +29,7 @@ public sealed class ImageSizeLimitTests
{
using (Assert.EnterMultipleScope())
{
Assert.That(LLMProviders.OPEN_AI.GetMaxImageSizeBytes(), Is.Null, "Nobody stated a limit, and no number stands in for that.");
Assert.That(LLMProviders.OPEN_AI.MaxImageSizeBytes, Is.Null, "Nobody stated a limit, and no number stands in for that.");
Assert.That(IImageSourceExtensions.MaxImageSizeBytesFor(ProviderOf(LLMProviders.OPEN_AI)), Is.EqualTo(IImageSourceExtensions.MAX_IMAGE_SIZE_BYTES));
}
}
@@ -39,7 +39,7 @@ public sealed class ImageSizeLimitTests
{
using (Assert.EnterMultipleScope())
{
Assert.That(Host.LLMMAN.GetMaxImageSizeBytes(), Is.EqualTo(1_048_576));
Assert.That(Host.LLMMAN.MaxImageSizeBytes, Is.EqualTo(1_048_576));
Assert.That(IImageSourceExtensions.MaxImageSizeBytesFor(ProviderOf(LLMProviders.SELF_HOSTED, Host.LLMMAN)), Is.EqualTo(1_048_576));
Assert.That(IImageSourceExtensions.MaxImageSizeBytesFor(ProviderOf(LLMProviders.SELF_HOSTED, Host.OLLAMA)), Is.EqualTo(IImageSourceExtensions.MAX_IMAGE_SIZE_BYTES), "Ollama states no limit we know of.");
}
@@ -33,7 +33,7 @@ public sealed class SystemPromptRoleTests
{
var profile = LLMProviders.OPEN_AI.GetModelProfile(new Model(modelId, null));
Assert.That(profile.SystemPromptRole.ToOpenAIRole(), Is.EqualTo(role));
Assert.That(profile.SystemPromptRole.OpenAIRole, Is.EqualTo(role));
}
[Test]
@@ -43,6 +43,6 @@ public sealed class SystemPromptRoleTests
// A model the rules do not know is almost always a new one, and the older generations which
// still want "system" say so in their families.
//
Assert.That(SystemPromptRole.UNKNOWN.ToOpenAIRole(), Is.EqualTo("developer"));
Assert.That(SystemPromptRole.UNKNOWN.OpenAIRole, Is.EqualTo("developer"));
}
}
@@ -21,7 +21,7 @@ public sealed class HostExtensionsTests
[TestCaseSource(nameof(ALL_HOSTS))]
public void TheDialogsOfferToLoadModelsExactlyWhereTheEngineCanListThem(Host host)
{
Assert.That(LLMProviders.SELF_HOSTED.CanLoadModels(host, null), Is.EqualTo(host.IsModelListSupported()));
Assert.That(LLMProviders.SELF_HOSTED.CanLoadModels(host, null), Is.EqualTo(host.IsModelListSupported));
}
[Test]
@@ -30,7 +30,7 @@ public sealed class HostExtensionsTests
//
// There is no fixed chat model to offer instead, so such an engine would offer an empty list:
//
var unlisted = ALL_HOSTS.Where(host => host is not Host.NONE && host.IsChatSupported() && !host.IsModelListSupported());
var unlisted = ALL_HOSTS.Where(host => host is not Host.NONE && host.IsChatSupported && !host.IsModelListSupported);
Assert.That(unlisted, Is.Empty);
}
@@ -40,7 +40,7 @@ public sealed class HostExtensionsTests
//
// There is no fixed embedding model to offer instead, so such an engine would offer an empty list:
//
var unlisted = ALL_HOSTS.Where(host => host.IsEmbeddingSupported() && !host.IsModelListSupported());
var unlisted = ALL_HOSTS.Where(host => host.IsEmbeddingSupported && !host.IsModelListSupported);
Assert.That(unlisted, Is.Empty);
}
@@ -51,7 +51,7 @@ public sealed class HostExtensionsTests
// The provider offers the one model of whisper.cpp under a fixed name. Any other engine
// which transcribes but cannot list its models would offer an empty list:
//
var unlisted = ALL_HOSTS.Where(host => host.IsTranscriptionSupported() && !host.IsModelListSupported());
var unlisted = ALL_HOSTS.Where(host => host.IsTranscriptionSupported && !host.IsModelListSupported);
Assert.That(unlisted, Is.EqualTo(new[] { Host.WHISPER_CPP }));
}
@@ -60,9 +60,9 @@ public sealed class HostExtensionsTests
{
using (Assert.EnterMultipleScope())
{
Assert.That(Host.NONE.IsModelListSupported(), Is.False);
Assert.That(Host.NONE.IsEmbeddingSupported(), Is.False);
Assert.That(Host.NONE.IsTranscriptionSupported(), Is.False);
Assert.That(Host.NONE.IsModelListSupported, Is.False);
Assert.That(Host.NONE.IsEmbeddingSupported, Is.False);
Assert.That(Host.NONE.IsTranscriptionSupported, Is.False);
Assert.That(LLMProviders.SELF_HOSTED.CanLoadModels(Host.NONE, "a key"), Is.False);
}
}