Skip to content

Commit 4d62bc8

Browse files
committed
Assert Gemini options binding in GenAIExtensionsTests
1 parent a05f7a5 commit 4d62bc8

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

SWEN3.Paperless.RabbitMq.Tests/Unit/GenAIExtensionsTests.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ public void AddPaperlessGenAI_RegistersServices()
1010
{
1111
var services = new ServiceCollection();
1212
var configuration = new ConfigurationBuilder()
13-
.AddInMemoryCollection(new Dictionary<string, string?> { ["Gemini:ApiKey"] = "test-key" })
13+
.AddInMemoryCollection(new Dictionary<string, string?>
14+
{
15+
["Gemini:ApiKey"] = "test-key",
16+
["Gemini:Model"] = "gemini-2.0-flash",
17+
["Gemini:TimeoutSeconds"] = "15"
18+
})
1419
.Build();
1520

1621
services.AddPaperlessGenAI(configuration);
@@ -19,5 +24,15 @@ public void AddPaperlessGenAI_RegistersServices()
1924
services.Should().Contain(sd => sd.ServiceType == typeof(ITextSummarizer));
2025
services.Should().Contain(sd =>
2126
sd.ServiceType == typeof(IHostedService) && sd.ImplementationType == typeof(GenAIWorker));
27+
28+
using var provider = services.BuildServiceProvider();
29+
30+
var options = provider.GetRequiredService<IOptions<GeminiOptions>>().Value;
31+
options.ApiKey.Should().Be("test-key");
32+
options.Model.Should().Be("gemini-2.0-flash");
33+
options.TimeoutSeconds.Should().Be(15);
34+
35+
var summarizer = provider.GetRequiredService<ITextSummarizer>();
36+
summarizer.Should().NotBeNull();
2237
}
2338
}

0 commit comments

Comments
 (0)