mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-05 06:07:21 +00:00
Turned getter-like extension methods into extension properties (#1157)
This commit is contained in:
1 parent
0375318b1b
commit
f649febf88
286 files changed
+1379
-1109
No files matched your search
@@ -20,7 +20,7 @@ public sealed class EnumNamesTests
|
||||
[TestCase(" Every_Message ")]
|
||||
public void ANameCountsWhateverItsCase(string text)
|
||||
{
|
||||
Assert.That(EnumNames.TryParse<DataSourceRetrievalMode>(text, out var mode), Is.True);
|
||||
Assert.That(DataSourceRetrievalMode.TryParseName(text, out var mode), Is.True);
|
||||
Assert.That(mode, Is.EqualTo(DataSourceRetrievalMode.EVERY_MESSAGE));
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public sealed class EnumNamesTests
|
||||
[TestCase("0x1")]
|
||||
public void ANumberDoesNotCountEvenWhenAMemberHasIt(string text)
|
||||
{
|
||||
Assert.That(EnumNames.TryParse<DataSourceRetrievalMode>(text, out _), Is.False, "Enum.TryParse would read 1 as EVERY_MESSAGE.");
|
||||
Assert.That(DataSourceRetrievalMode.TryParseName(text, out _), Is.False, "Enum.TryParse would read 1 as EVERY_MESSAGE.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -37,8 +37,8 @@ public sealed class EnumNamesTests
|
||||
{
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(EnumNames.TryParse<DataSourceRetrievalMode>("SEMANTIC_SEARCH, EVERY_MESSAGE", out _), Is.False, "Enum.TryParse would combine them to EVERY_MESSAGE.");
|
||||
Assert.That(EnumNames.TryParse<ConfidenceLevel>("HIGH, MEDIUM", out _), Is.False, "Enum.TryParse would combine them to a confidence level above HIGH.");
|
||||
Assert.That(DataSourceRetrievalMode.TryParseName("SEMANTIC_SEARCH, EVERY_MESSAGE", out _), Is.False, "Enum.TryParse would combine them to EVERY_MESSAGE.");
|
||||
Assert.That(ConfidenceLevel.TryParseName("HIGH, MEDIUM", out _), Is.False, "Enum.TryParse would combine them to a confidence level above HIGH.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public sealed class EnumNamesTests
|
||||
[TestCase("EVERY MESSAGE")]
|
||||
public void NoNameDoesNotCount(string? text)
|
||||
{
|
||||
Assert.That(EnumNames.TryParse<DataSourceRetrievalMode>(text, out var mode), Is.False);
|
||||
Assert.That(DataSourceRetrievalMode.TryParseName(text, out var mode), Is.False);
|
||||
Assert.That(mode, Is.EqualTo(default(DataSourceRetrievalMode)));
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public sealed class TranscriptionOpusBitrateTests
|
||||
foreach (var bitrate in Enum.GetValues<TranscriptionOpusBitrate>())
|
||||
{
|
||||
Assert.That(EXPECTED_BITS_PER_SECOND.ContainsKey(bitrate), Is.True, $"The selection offers {bitrate}, so this test has to state what that is worth in bits per second.");
|
||||
Assert.That(bitrate.GetBitsPerSecond(), Is.EqualTo(EXPECTED_BITS_PER_SECOND[bitrate]), $"{bitrate} is what the user picked; anything else travels to the encoder behind their back.");
|
||||
Assert.That(bitrate.BitsPerSecond, Is.EqualTo(EXPECTED_BITS_PER_SECOND[bitrate]), $"{bitrate} is what the user picked; anything else travels to the encoder behind their back.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public sealed class TranscriptionOpusBitrateTests
|
||||
var undeclared = (TranscriptionOpusBitrate)999;
|
||||
|
||||
Assert.That(Enum.IsDefined(undeclared), Is.False, "The point of this test is a value outside the enum; a declared one would prove nothing.");
|
||||
Assert.That(undeclared.GetBitsPerSecond(), Is.EqualTo(128_000u), "Not knowing which quality was meant is no reason to pick the worst one available.");
|
||||
Assert.That(undeclared.BitsPerSecond, Is.EqualTo(128_000u), "Not knowing which quality was meant is no reason to pick the worst one available.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in new issue
Block a user