Skip to content

Commit bb23454

Browse files
committedJan 18, 2025
misc
1 parent bb04cea commit bb23454

File tree

3 files changed

+11
-25
lines changed

3 files changed

+11
-25
lines changed
 

‎SpongeEngine.KoboldSharp.Tests/Integration/IntegrationTestBase.cs

+5-7
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@ protected IntegrationTestBase(ITestOutputHelper output)
1919
Logger = LoggerFactory
2020
.Create(builder => builder.AddXUnit(output))
2121
.CreateLogger(GetType());
22-
23-
var httpClient = new HttpClient
24-
{
25-
BaseAddress = new Uri(TestConfig.NativeApiBaseUrl),
26-
Timeout = TimeSpan.FromSeconds(TestConfig.TimeoutSeconds)
27-
};
2822

2923
Client = new KoboldSharpClient(
3024
new KoboldSharpClientOptions()
3125
{
32-
HttpClient = httpClient,
26+
HttpClient = new HttpClient
27+
{
28+
BaseAddress = new Uri(TestConfig.NativeApiBaseUrl),
29+
Timeout = TimeSpan.FromSeconds(TestConfig.TimeoutSeconds)
30+
},
3331
BaseUrl = TestConfig.BaseUrl,
3432
Logger = Logger,
3533
});

‎SpongeEngine.KoboldSharp.Tests/Unit/StableDiffusion/ImageToImage.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public async Task ImageToImage_WithDifferentDenoisingStrength_ShouldWork()
8686
};
8787

8888
// Log what we're doing
89-
Logger.LogInformation($"Testing denoising strength: {strength}");
89+
Client.Options.Logger.LogInformation($"Testing denoising strength: {strength}");
9090

9191
// Act
9292
var result = await Client.ImageToImageAsync(request);
@@ -97,7 +97,7 @@ public async Task ImageToImage_WithDifferentDenoisingStrength_ShouldWork()
9797
result.Images.Should().HaveCount(1);
9898
result.Images[0].Should().Be(mockBase64Image);
9999

100-
Logger.LogInformation($"Successfully generated image with denoising strength {strength}");
100+
Client.Options.Logger.LogInformation($"Successfully generated image with denoising strength {strength}");
101101
}
102102
}
103103

‎SpongeEngine.KoboldSharp.Tests/Unit/UnitTestBase.cs

+4-16
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,20 @@ namespace SpongeEngine.KoboldSharp.Tests.Unit
88
public abstract class UnitTestBase : TestBase
99
{
1010
protected readonly WireMockServer Server;
11-
protected readonly ILogger Logger;
12-
protected readonly string BaseUrl;
1311
protected readonly KoboldSharpClient Client;
14-
protected readonly HttpClient HttpClient;
1512

1613
protected UnitTestBase(ITestOutputHelper output)
1714
{
1815
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) };
2416
Client = new KoboldSharpClient(
2517
new KoboldSharpClientOptions()
2618
{
27-
HttpClient = HttpClient,
19+
HttpClient = new HttpClient { BaseAddress = new Uri(Server.Urls[0]) },
2820
BaseUrl = TestConfig.BaseUrl,
29-
Logger = Logger,
21+
Logger = LoggerFactory
22+
.Create(builder => builder.AddXUnit(output))
23+
.CreateLogger(GetType()),
3024
});
3125
}
32-
33-
public virtual void Dispose()
34-
{
35-
HttpClient.Dispose();
36-
Server.Dispose();
37-
}
3826
}
3927
}

0 commit comments

Comments
 (0)