Commit bb23454 1 parent bb04cea commit bb23454 Copy full SHA for bb23454
File tree 3 files changed +11
-25
lines changed
SpongeEngine.KoboldSharp.Tests
3 files changed +11
-25
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,15 @@ protected IntegrationTestBase(ITestOutputHelper output)
19
19
Logger = LoggerFactory
20
20
. Create ( builder => builder . AddXUnit ( output ) )
21
21
. CreateLogger ( GetType ( ) ) ;
22
-
23
- var httpClient = new HttpClient
24
- {
25
- BaseAddress = new Uri ( TestConfig . NativeApiBaseUrl ) ,
26
- Timeout = TimeSpan . FromSeconds ( TestConfig . TimeoutSeconds )
27
- } ;
28
22
29
23
Client = new KoboldSharpClient (
30
24
new KoboldSharpClientOptions ( )
31
25
{
32
- HttpClient = httpClient ,
26
+ HttpClient = new HttpClient
27
+ {
28
+ BaseAddress = new Uri ( TestConfig . NativeApiBaseUrl ) ,
29
+ Timeout = TimeSpan . FromSeconds ( TestConfig . TimeoutSeconds )
30
+ } ,
33
31
BaseUrl = TestConfig . BaseUrl ,
34
32
Logger = Logger ,
35
33
} ) ;
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ public async Task ImageToImage_WithDifferentDenoisingStrength_ShouldWork()
86
86
} ;
87
87
88
88
// Log what we're doing
89
- Logger . LogInformation ( $ "Testing denoising strength: { strength } ") ;
89
+ Client . Options . Logger . LogInformation ( $ "Testing denoising strength: { strength } ") ;
90
90
91
91
// Act
92
92
var result = await Client . ImageToImageAsync ( request ) ;
@@ -97,7 +97,7 @@ public async Task ImageToImage_WithDifferentDenoisingStrength_ShouldWork()
97
97
result . Images . Should ( ) . HaveCount ( 1 ) ;
98
98
result . Images [ 0 ] . Should ( ) . Be ( mockBase64Image ) ;
99
99
100
- Logger . LogInformation ( $ "Successfully generated image with denoising strength { strength } ") ;
100
+ Client . Options . Logger . LogInformation ( $ "Successfully generated image with denoising strength { strength } ") ;
101
101
}
102
102
}
103
103
Original file line number Diff line number Diff line change @@ -8,32 +8,20 @@ namespace SpongeEngine.KoboldSharp.Tests.Unit
8
8
public abstract class UnitTestBase : TestBase
9
9
{
10
10
protected readonly WireMockServer Server ;
11
- protected readonly ILogger Logger ;
12
- protected readonly string BaseUrl ;
13
11
protected readonly KoboldSharpClient Client ;
14
- protected readonly HttpClient HttpClient ;
15
12
16
13
protected UnitTestBase ( ITestOutputHelper output )
17
14
{
18
15
Server = WireMockServer . Start ( ) ;
19
- BaseUrl = Server . Urls [ 0 ] ;
20
- Logger = LoggerFactory
21
- . Create ( builder => builder . AddXUnit ( output ) )
22
- . CreateLogger ( GetType ( ) ) ;
23
- HttpClient = new HttpClient { BaseAddress = new Uri ( BaseUrl ) } ;
24
16
Client = new KoboldSharpClient (
25
17
new KoboldSharpClientOptions ( )
26
18
{
27
- HttpClient = HttpClient ,
19
+ HttpClient = new HttpClient { BaseAddress = new Uri ( Server . Urls [ 0 ] ) } ,
28
20
BaseUrl = TestConfig . BaseUrl ,
29
- Logger = Logger ,
21
+ Logger = LoggerFactory
22
+ . Create ( builder => builder . AddXUnit ( output ) )
23
+ . CreateLogger ( GetType ( ) ) ,
30
24
} ) ;
31
25
}
32
-
33
- public virtual void Dispose ( )
34
- {
35
- HttpClient . Dispose ( ) ;
36
- Server . Dispose ( ) ;
37
- }
38
26
}
39
27
}
You can’t perform that action at this time.
0 commit comments