Enhance person card functionality: add custom prompt textarea persistence during input, streamline portrait prompt API by removing unused parameters, and ensure proper button state management based on input. Update tests to verify new behavior.
This commit is contained in:
@@ -2,6 +2,9 @@ using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using HSchool.Server.Game;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Http;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
@@ -100,6 +103,38 @@ public class SwarmUiClientTests
|
||||
Assert.False(document.RootElement.TryGetProperty("clipskip", out _));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Registration_StripsStandardResilienceHandler()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
services.AddLogging();
|
||||
services.ConfigureHttpClientDefaults(http => http.AddStandardResilienceHandler());
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddInMemoryCollection(new Dictionary<string, string?>
|
||||
{
|
||||
["SwarmUi:BaseUrl"] = "http://127.0.0.1:7801",
|
||||
["SwarmUi:TimeoutSeconds"] = "180",
|
||||
})
|
||||
.Build();
|
||||
services.AddSwarmUi(configuration);
|
||||
|
||||
using var provider = services.BuildServiceProvider();
|
||||
var factory = provider.GetRequiredService<IHttpMessageHandlerFactory>();
|
||||
using var handler = factory.CreateHandler(nameof(SwarmUiClient));
|
||||
|
||||
Assert.DoesNotContain(
|
||||
HandlerTypeNames(handler),
|
||||
name => name.Contains("Resilience", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
private static IEnumerable<string> HandlerTypeNames(HttpMessageHandler handler)
|
||||
{
|
||||
for (HttpMessageHandler? current = handler; current is not null; current = (current as DelegatingHandler)?.InnerHandler)
|
||||
{
|
||||
yield return current.GetType().FullName ?? current.GetType().Name;
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class CapturingHandler : HttpMessageHandler
|
||||
{
|
||||
public string? GenerateBody { get; private set; }
|
||||
|
||||
Reference in New Issue
Block a user