File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
SWEN3.Paperless.RabbitMq.Tests/Unit Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments