feat(headless): complete portable single-session host
This commit is contained in:
parent
fbebb91848
commit
f8cb840fb1
30 changed files with 3571 additions and 32 deletions
173
tests/AcDream.Headless.Tests/HeadlessCredentialResolverTests.cs
Normal file
173
tests/AcDream.Headless.Tests/HeadlessCredentialResolverTests.cs
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
using AcDream.Headless.Configuration;
|
||||
using AcDream.Headless.Credentials;
|
||||
|
||||
namespace AcDream.Headless.Tests;
|
||||
|
||||
public sealed class HeadlessCredentialResolverTests
|
||||
{
|
||||
[Fact]
|
||||
public void EnvironmentSecretIsRedactedAndErasable()
|
||||
{
|
||||
const string secretValue = "test-secret-value";
|
||||
var environment = new FixtureCredentialEnvironment(
|
||||
isLinux: false,
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
["BOT_PASSWORD"] = secretValue,
|
||||
});
|
||||
var resolver = new HeadlessCredentialResolver(
|
||||
TextReader.Null,
|
||||
Environment.CurrentDirectory,
|
||||
environment);
|
||||
|
||||
HeadlessCredentialSecret secret = resolver.Resolve(
|
||||
"bot",
|
||||
new HeadlessCredentialReference
|
||||
{
|
||||
Provider = HeadlessCredentialProviderKind.Environment,
|
||||
Reference = "BOT_PASSWORD",
|
||||
});
|
||||
|
||||
Assert.Equal(secretValue, secret.Reveal());
|
||||
Assert.DoesNotContain(secretValue, secret.ToString());
|
||||
secret.Dispose();
|
||||
Assert.True(secret.IsDisposed);
|
||||
Assert.Throws<ObjectDisposedException>(secret.Reveal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void StandardInputConsumesOneSecretWithoutEchoingIt()
|
||||
{
|
||||
const string secretValue = "stdin-secret";
|
||||
var resolver = new HeadlessCredentialResolver(
|
||||
new StringReader(secretValue + Environment.NewLine),
|
||||
Environment.CurrentDirectory,
|
||||
new FixtureCredentialEnvironment(
|
||||
false,
|
||||
new Dictionary<string, string>()));
|
||||
|
||||
using HeadlessCredentialSecret secret = resolver.Resolve(
|
||||
"bot",
|
||||
new HeadlessCredentialReference
|
||||
{
|
||||
Provider = HeadlessCredentialProviderKind.StandardInput,
|
||||
Reference = "bot-stdin",
|
||||
});
|
||||
|
||||
Assert.Equal(secretValue, secret.Reveal());
|
||||
Assert.DoesNotContain(secretValue, secret.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CredentialFileIsResolvedRelativeToConfiguredDirectory()
|
||||
{
|
||||
string directory = Path.Combine(
|
||||
Path.GetTempPath(),
|
||||
$"acdream-credentials-{Guid.NewGuid():N}");
|
||||
Directory.CreateDirectory(directory);
|
||||
string path = Path.Combine(directory, "bot.pass");
|
||||
File.WriteAllText(path, "file-secret" + Environment.NewLine);
|
||||
try
|
||||
{
|
||||
var resolver = new HeadlessCredentialResolver(
|
||||
TextReader.Null,
|
||||
directory,
|
||||
new FixtureCredentialEnvironment(
|
||||
false,
|
||||
new Dictionary<string, string>()));
|
||||
|
||||
using HeadlessCredentialSecret secret = resolver.Resolve(
|
||||
"bot",
|
||||
new HeadlessCredentialReference
|
||||
{
|
||||
Provider = HeadlessCredentialProviderKind.File,
|
||||
Reference = "bot.pass",
|
||||
});
|
||||
|
||||
Assert.Equal("file-secret", secret.Reveal());
|
||||
}
|
||||
finally
|
||||
{
|
||||
File.Delete(path);
|
||||
Directory.Delete(directory);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MissingSecretErrorNeverContainsAnotherSecret()
|
||||
{
|
||||
const string unrelatedSecret = "must-not-leak";
|
||||
var resolver = new HeadlessCredentialResolver(
|
||||
new StringReader(string.Empty),
|
||||
Environment.CurrentDirectory,
|
||||
new FixtureCredentialEnvironment(
|
||||
false,
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
["OTHER"] = unrelatedSecret,
|
||||
}));
|
||||
|
||||
HeadlessCredentialException error =
|
||||
Assert.Throws<HeadlessCredentialException>(() =>
|
||||
resolver.Resolve(
|
||||
"bot",
|
||||
new HeadlessCredentialReference
|
||||
{
|
||||
Provider =
|
||||
HeadlessCredentialProviderKind.Environment,
|
||||
Reference = "MISSING",
|
||||
}));
|
||||
|
||||
Assert.DoesNotContain(unrelatedSecret, error.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LinuxRejectsGroupOrOtherCredentialPermissions()
|
||||
{
|
||||
if (!OperatingSystem.IsLinux())
|
||||
return;
|
||||
|
||||
string path = Path.Combine(
|
||||
Path.GetTempPath(),
|
||||
$"acdream-credential-{Guid.NewGuid():N}");
|
||||
File.WriteAllText(path, "linux-secret");
|
||||
File.SetUnixFileMode(
|
||||
path,
|
||||
UnixFileMode.UserRead | UnixFileMode.GroupRead);
|
||||
try
|
||||
{
|
||||
var resolver = new HeadlessCredentialResolver(
|
||||
TextReader.Null,
|
||||
Path.GetDirectoryName(path)!,
|
||||
new FixtureCredentialEnvironment(
|
||||
true,
|
||||
new Dictionary<string, string>()));
|
||||
|
||||
Assert.Throws<HeadlessCredentialException>(() =>
|
||||
resolver.Resolve(
|
||||
"bot",
|
||||
new HeadlessCredentialReference
|
||||
{
|
||||
Provider = HeadlessCredentialProviderKind.File,
|
||||
Reference = Path.GetFileName(path),
|
||||
}));
|
||||
}
|
||||
finally
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class FixtureCredentialEnvironment(
|
||||
bool isLinux,
|
||||
IReadOnlyDictionary<string, string> values)
|
||||
: IHeadlessCredentialEnvironment
|
||||
{
|
||||
public bool IsLinux { get; } = isLinux;
|
||||
|
||||
public string? GetEnvironmentVariable(string name) =>
|
||||
values.TryGetValue(name, out string? value)
|
||||
? value
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
|
@ -41,10 +41,9 @@ public sealed class HeadlessEntryPointTests
|
|||
|
||||
[Theory]
|
||||
[InlineData("""{"version":2,"sessions":[]}""", "Unsupported configuration version")]
|
||||
[InlineData("""{"version":1,"sessions":[],"password":"secret"}""", "could not be mapped")]
|
||||
[InlineData("""{"version":1,"sessions":[{"id":"bot"},{"id":"bot"}]}""", "Duplicate session id")]
|
||||
[InlineData("""{"version":1,"sessions":[],"password":"secret"}""", "JSON document is invalid")]
|
||||
[InlineData("""{"version":1,"sessions":[null]}""", "non-empty id")]
|
||||
[InlineData("""{"version":1}""", "required properties")]
|
||||
[InlineData("""{"version":1}""", "JSON document is invalid")]
|
||||
public void ValidateRejectsInvalidOrSecretShapedConfiguration(
|
||||
string json,
|
||||
string expectedError)
|
||||
|
|
@ -67,6 +66,51 @@ public sealed class HeadlessEntryPointTests
|
|||
Assert.Equal(string.Empty, output.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ValidateAcceptsCompleteSingleSessionConfiguration()
|
||||
{
|
||||
using var file = TemporaryConfiguration.Create(
|
||||
ConfigurationWith(Session("bot", "BOT_PASSWORD")));
|
||||
using var output = new StringWriter();
|
||||
using var error = new StringWriter();
|
||||
|
||||
int exitCode = HeadlessEntryPoint.Run(
|
||||
["validate", "--config", file.Path],
|
||||
output,
|
||||
error);
|
||||
|
||||
Assert.Equal(0, exitCode);
|
||||
Assert.Contains("1 session(s)", output.ToString());
|
||||
Assert.Equal(string.Empty, error.ToString());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("duplicate-id")]
|
||||
[InlineData("duplicate-credential")]
|
||||
public void ValidateRejectsAmbiguousSessionOwnership(string scenario)
|
||||
{
|
||||
string second = scenario == "duplicate-id"
|
||||
? Session("bot", "SECOND_PASSWORD")
|
||||
: Session("second", "BOT_PASSWORD");
|
||||
string expected = scenario == "duplicate-id"
|
||||
? "Duplicate session id"
|
||||
: "already in use";
|
||||
using var file = TemporaryConfiguration.Create(
|
||||
ConfigurationWith(
|
||||
Session("bot", "BOT_PASSWORD"),
|
||||
second));
|
||||
using var output = new StringWriter();
|
||||
using var error = new StringWriter();
|
||||
|
||||
int exitCode = HeadlessEntryPoint.Run(
|
||||
["validate", "--config", file.Path],
|
||||
output,
|
||||
error);
|
||||
|
||||
Assert.Equal(3, exitCode);
|
||||
Assert.Contains(expected, error.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UnknownCommandReturnsUsageError()
|
||||
{
|
||||
|
|
@ -83,6 +127,15 @@ public sealed class HeadlessEntryPointTests
|
|||
Assert.Equal(string.Empty, output.ToString());
|
||||
}
|
||||
|
||||
private static string ConfigurationWith(params string[] sessions) =>
|
||||
$$"""{"version":1,"sessions":[{{string.Join(",", sessions)}}]}""";
|
||||
|
||||
private static string Session(string id, string credentialReference) =>
|
||||
$"{{\"id\":\"{id}\",\"endpoint\":{{\"host\":\"127.0.0.1\",\"port\":9000}},"
|
||||
+ "\"account\":\"account\",\"character\":{\"index\":0},"
|
||||
+ "\"policy\":{\"id\":\"idle\"},\"credential\":"
|
||||
+ $"{{\"provider\":\"environment\",\"reference\":\"{credentialReference}\"}}}}";
|
||||
|
||||
private sealed class TemporaryConfiguration : IDisposable
|
||||
{
|
||||
private TemporaryConfiguration(string path)
|
||||
|
|
|
|||
129
tests/AcDream.Headless.Tests/HeadlessPathSetTests.cs
Normal file
129
tests/AcDream.Headless.Tests/HeadlessPathSetTests.cs
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
using AcDream.Headless.Configuration;
|
||||
using AcDream.Headless.Platform;
|
||||
|
||||
namespace AcDream.Headless.Tests;
|
||||
|
||||
public sealed class HeadlessPathSetTests
|
||||
{
|
||||
[Fact]
|
||||
public void LinuxUsesXdgDirectoriesWhenConfigured()
|
||||
{
|
||||
string root = Path.GetFullPath(
|
||||
Path.Combine(Path.GetTempPath(), "acdream-xdg"));
|
||||
var platform = new FixturePlatform(isWindows: false)
|
||||
{
|
||||
CurrentDirectoryValue = Path.Combine(root, "work"),
|
||||
UserProfile = Path.Combine(root, "home", "bot"),
|
||||
Variables =
|
||||
{
|
||||
["XDG_CONFIG_HOME"] = Path.Combine(root, "cfg"),
|
||||
["XDG_DATA_HOME"] = Path.Combine(root, "data"),
|
||||
["XDG_CACHE_HOME"] = Path.Combine(root, "cache"),
|
||||
},
|
||||
};
|
||||
|
||||
HeadlessPathSet paths = HeadlessPathSet.Resolve(
|
||||
new HeadlessPathOverrides(),
|
||||
platform);
|
||||
|
||||
Assert.Equal(
|
||||
Path.Combine(root, "cfg", "acdream"),
|
||||
paths.ConfigDirectory);
|
||||
Assert.Equal(
|
||||
Path.Combine(root, "data", "acdream"),
|
||||
paths.DataDirectory);
|
||||
Assert.Equal(
|
||||
Path.Combine(root, "cache", "acdream"),
|
||||
paths.CacheDirectory);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LinuxFallsBackToHomeAndNormalizesOverrides()
|
||||
{
|
||||
var platform = new FixturePlatform(isWindows: false)
|
||||
{
|
||||
CurrentDirectoryValue = Path.GetFullPath(
|
||||
Path.Combine(Path.GetTempPath(), "acdream work")),
|
||||
UserProfile = Path.GetFullPath(
|
||||
Path.Combine(Path.GetTempPath(), "bot home")),
|
||||
};
|
||||
|
||||
HeadlessPathSet paths = HeadlessPathSet.Resolve(
|
||||
new HeadlessPathOverrides(
|
||||
ConfigDirectory: "relative cfg",
|
||||
DataDirectory: "dåta",
|
||||
CacheDirectory: "cache"),
|
||||
platform);
|
||||
|
||||
Assert.Equal(
|
||||
Path.GetFullPath("relative cfg", platform.CurrentDirectoryValue),
|
||||
paths.ConfigDirectory);
|
||||
Assert.Equal(
|
||||
Path.GetFullPath("dåta", platform.CurrentDirectoryValue),
|
||||
paths.DataDirectory);
|
||||
Assert.Equal(
|
||||
Path.GetFullPath("cache", platform.CurrentDirectoryValue),
|
||||
paths.CacheDirectory);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WindowsUsesRoamingForConfigAndLocalForDataAndCache()
|
||||
{
|
||||
string root = Path.GetFullPath(
|
||||
Path.Combine(Path.GetTempPath(), "acdream-windows"));
|
||||
var platform = new FixturePlatform(isWindows: true)
|
||||
{
|
||||
CurrentDirectoryValue = Path.Combine(root, "work"),
|
||||
ApplicationData = Path.Combine(root, "AppData", "Roaming"),
|
||||
LocalApplicationData = Path.Combine(root, "AppData", "Local"),
|
||||
UserProfile = Path.Combine(root, "Users", "bot"),
|
||||
};
|
||||
|
||||
HeadlessPathSet paths = HeadlessPathSet.Resolve(
|
||||
new HeadlessPathOverrides(),
|
||||
platform);
|
||||
|
||||
Assert.EndsWith(
|
||||
Path.Combine("AppData", "Roaming", "acdream"),
|
||||
paths.ConfigDirectory);
|
||||
Assert.EndsWith(
|
||||
Path.Combine("AppData", "Local", "acdream"),
|
||||
paths.DataDirectory);
|
||||
Assert.EndsWith(
|
||||
Path.Combine("AppData", "Local", "acdream", "cache"),
|
||||
paths.CacheDirectory);
|
||||
}
|
||||
|
||||
private sealed class FixturePlatform(bool isWindows)
|
||||
: IHeadlessPlatformEnvironment
|
||||
{
|
||||
public bool IsWindows { get; } = isWindows;
|
||||
public string CurrentDirectoryValue { get; init; } =
|
||||
Environment.CurrentDirectory;
|
||||
public string CurrentDirectory => CurrentDirectoryValue;
|
||||
public string UserProfile { get; init; } =
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
public string ApplicationData { get; init; } =
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
public string LocalApplicationData { get; init; } =
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
public Dictionary<string, string> Variables { get; } =
|
||||
new(StringComparer.Ordinal);
|
||||
|
||||
public string? GetEnvironmentVariable(string name) =>
|
||||
Variables.TryGetValue(name, out string? value)
|
||||
? value
|
||||
: null;
|
||||
|
||||
public string GetFolderPath(Environment.SpecialFolder folder) =>
|
||||
folder switch
|
||||
{
|
||||
System.Environment.SpecialFolder.UserProfile => UserProfile,
|
||||
System.Environment.SpecialFolder.ApplicationData =>
|
||||
ApplicationData,
|
||||
System.Environment.SpecialFolder.LocalApplicationData =>
|
||||
LocalApplicationData,
|
||||
_ => string.Empty,
|
||||
};
|
||||
}
|
||||
}
|
||||
218
tests/AcDream.Headless.Tests/HeadlessSessionHostTests.cs
Normal file
218
tests/AcDream.Headless.Tests/HeadlessSessionHostTests.cs
Normal file
|
|
@ -0,0 +1,218 @@
|
|||
using System.Net;
|
||||
using AcDream.Core.Net;
|
||||
using AcDream.Core.Net.Messages;
|
||||
using AcDream.Headless.Configuration;
|
||||
using AcDream.Headless.Credentials;
|
||||
using AcDream.Headless.Diagnostics;
|
||||
using AcDream.Headless.Hosting;
|
||||
using AcDream.Headless.Platform;
|
||||
using AcDream.Runtime;
|
||||
using AcDream.Runtime.Session;
|
||||
|
||||
namespace AcDream.Headless.Tests;
|
||||
|
||||
public sealed class HeadlessSessionHostTests
|
||||
{
|
||||
[Fact]
|
||||
public void SingleSessionStartsReconnectsAndConvergesWithoutPresentation()
|
||||
{
|
||||
var operations = new FixtureSessionOperations();
|
||||
using var diagnosticsOutput = new StringWriter();
|
||||
using var credential = new HeadlessCredentialSecret(
|
||||
"fixture",
|
||||
"password");
|
||||
var host = new HeadlessSessionHost(
|
||||
Descriptor(),
|
||||
credential,
|
||||
new HeadlessDiagnosticWriter(diagnosticsOutput),
|
||||
operations);
|
||||
|
||||
RuntimeSessionStartResult first = host.Start();
|
||||
ulong firstGeneration = host.Runtime.Generation.Value;
|
||||
host.Tick(0.015d);
|
||||
RuntimeSessionStartResult second = host.Reconnect();
|
||||
|
||||
Assert.Equal(RuntimeSessionStartStatus.Connected, first.Status);
|
||||
Assert.Equal(RuntimeSessionStartStatus.Connected, second.Status);
|
||||
Assert.Equal(0x50000002u, first.CharacterId);
|
||||
Assert.Equal("Headless", host.ActiveCharacterName);
|
||||
Assert.True(host.Runtime.Session.IsInWorld);
|
||||
Assert.True(host.Runtime.Generation.Value > firstGeneration);
|
||||
Assert.Equal(2, operations.CreatedSessionCount);
|
||||
Assert.Equal(1, operations.DisposedSessionCount);
|
||||
|
||||
host.Dispose();
|
||||
|
||||
Assert.Equal(2, operations.DisposedSessionCount);
|
||||
Assert.True(host.Runtime.CaptureOwnership().IsConverged);
|
||||
Assert.True(credential.IsDisposed);
|
||||
string diagnostics = diagnosticsOutput.ToString();
|
||||
Assert.Contains("\"state\":\"start-result\"", diagnostics);
|
||||
Assert.DoesNotContain("password", diagnostics);
|
||||
Assert.DoesNotContain("AcDream.App", diagnostics);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ProcessHostRunsUntilCancellationAndReturnsStableExitCode()
|
||||
{
|
||||
var configuration = new HeadlessConfiguration
|
||||
{
|
||||
Version = 1,
|
||||
Sessions =
|
||||
[
|
||||
Descriptor(
|
||||
HeadlessCredentialProviderKind.StandardInput,
|
||||
"stdin-bot"),
|
||||
],
|
||||
};
|
||||
HeadlessPathSet paths = HeadlessPathSet.Resolve(
|
||||
new HeadlessPathOverrides());
|
||||
using var diagnostics = new StringWriter();
|
||||
var operations = new FixtureSessionOperations();
|
||||
using var host = new HeadlessProcessHost(
|
||||
configuration,
|
||||
paths,
|
||||
new StringReader("process-password" + Environment.NewLine),
|
||||
diagnostics,
|
||||
operations);
|
||||
using var cancellation = new CancellationTokenSource();
|
||||
cancellation.Cancel();
|
||||
|
||||
HeadlessExitCode result =
|
||||
await host.RunAsync(cancellation.Token);
|
||||
|
||||
Assert.Equal(HeadlessExitCode.Success, result);
|
||||
Assert.True(host.Session.Runtime.Session.IsInWorld);
|
||||
Assert.DoesNotContain(
|
||||
"process-password",
|
||||
diagnostics.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TeardownRetriesOnlyTheUnfinishedSuffix()
|
||||
{
|
||||
var operations = new FixtureSessionOperations();
|
||||
var writer = new FailOnceTextWriter();
|
||||
using var credential = new HeadlessCredentialSecret(
|
||||
"fixture",
|
||||
"password");
|
||||
var host = new HeadlessSessionHost(
|
||||
Descriptor(),
|
||||
credential,
|
||||
new HeadlessDiagnosticWriter(writer),
|
||||
operations);
|
||||
Assert.Equal(
|
||||
RuntimeSessionStartStatus.Connected,
|
||||
host.Start().Status);
|
||||
writer.FailNextWrite = true;
|
||||
|
||||
Assert.Throws<IOException>(host.Dispose);
|
||||
Assert.Equal(1, operations.DisposedSessionCount);
|
||||
|
||||
host.Dispose();
|
||||
|
||||
Assert.Equal(1, operations.DisposedSessionCount);
|
||||
Assert.True(host.Runtime.CaptureOwnership().IsConverged);
|
||||
}
|
||||
|
||||
private static HeadlessSessionDescriptor Descriptor(
|
||||
HeadlessCredentialProviderKind provider =
|
||||
HeadlessCredentialProviderKind.Environment,
|
||||
string credentialReference = "BOT_PASSWORD") => new()
|
||||
{
|
||||
Id = "bot",
|
||||
Endpoint = new HeadlessEndpointDescriptor
|
||||
{
|
||||
Host = "127.0.0.1",
|
||||
Port = 9000,
|
||||
},
|
||||
Account = "account",
|
||||
Character = new HeadlessCharacterSelector
|
||||
{
|
||||
Name = "headless",
|
||||
},
|
||||
Policy = new HeadlessBotPolicyDescriptor
|
||||
{
|
||||
Id = "idle",
|
||||
},
|
||||
Credential = new HeadlessCredentialReference
|
||||
{
|
||||
Provider = provider,
|
||||
Reference = credentialReference,
|
||||
},
|
||||
};
|
||||
|
||||
private sealed class FixtureSessionOperations : ILiveSessionOperations
|
||||
{
|
||||
public int CreatedSessionCount { get; private set; }
|
||||
public int DisposedSessionCount { get; private set; }
|
||||
|
||||
public IPEndPoint ResolveEndpoint(string host, int port) =>
|
||||
new(IPAddress.Loopback, port);
|
||||
|
||||
public WorldSession CreateSession(IPEndPoint endpoint)
|
||||
{
|
||||
CreatedSessionCount++;
|
||||
return new WorldSession(endpoint);
|
||||
}
|
||||
|
||||
public void Connect(
|
||||
WorldSession session,
|
||||
string user,
|
||||
string password)
|
||||
{
|
||||
}
|
||||
|
||||
public CharacterList.Parsed GetCharacters(
|
||||
WorldSession session) =>
|
||||
new(
|
||||
0u,
|
||||
[
|
||||
new CharacterList.Character(
|
||||
0x50000001u,
|
||||
"Other",
|
||||
0u),
|
||||
new CharacterList.Character(
|
||||
0x50000002u,
|
||||
"Headless",
|
||||
0u),
|
||||
],
|
||||
[],
|
||||
11,
|
||||
"account",
|
||||
true,
|
||||
true);
|
||||
|
||||
public void EnterWorld(
|
||||
WorldSession session,
|
||||
int activeCharacterIndex)
|
||||
{
|
||||
}
|
||||
|
||||
public void Tick(WorldSession session)
|
||||
{
|
||||
}
|
||||
|
||||
public void DisposeSession(WorldSession session)
|
||||
{
|
||||
DisposedSessionCount++;
|
||||
session.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class FailOnceTextWriter : StringWriter
|
||||
{
|
||||
public bool FailNextWrite { get; set; }
|
||||
|
||||
public override void WriteLine(string? value)
|
||||
{
|
||||
if (FailNextWrite)
|
||||
{
|
||||
FailNextWrite = false;
|
||||
throw new IOException("fixture write failure");
|
||||
}
|
||||
base.WriteLine(value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue