test(core-tests): 收敛测试桩与辅助类型 warning

- 更新 ArchitectureContext、ArchitectureServices、GameContext 与环境测试桩的异常类型以满足 analyzer 约束

- 补齐 AsyncTestModel 与 AsyncTestSystem 的异步等待配置并保持测试语义不变

- 调整 ResultTests 的异类异常断言样例以避免新增编译与 analyzer 噪音
This commit is contained in:
gewuyou 2026-04-25 10:18:40 +08:00
parent b45e551fa8
commit 03c73a8ee5
7 changed files with 29 additions and 29 deletions

View File

@ -339,7 +339,7 @@ public class ArchitectureContextTests
{
workersReady.Signal();
startGate.Wait();
return await context.SendRequestAsync(new TestCqrsRequest());
return await context.SendRequestAsync(new TestCqrsRequest()).ConfigureAwait(false);
}))
.ToArray();

View File

@ -351,12 +351,12 @@ public class TestArchitectureContextV3 : IArchitectureContext
public ValueTask<TResponse> SendRequestAsync<TResponse>(IRequest<TResponse> request,
CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
public TResponse SendRequest<TResponse>(IRequest<TResponse> request)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
/// <summary>
@ -371,7 +371,7 @@ public class TestArchitectureContextV3 : IArchitectureContext
GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command,
CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
/// <summary>
@ -383,7 +383,7 @@ public class TestArchitectureContextV3 : IArchitectureContext
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
public TResponse SendCommand<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
/// <summary>
@ -398,7 +398,7 @@ public class TestArchitectureContextV3 : IArchitectureContext
GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query,
CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
/// <summary>
@ -410,32 +410,32 @@ public class TestArchitectureContextV3 : IArchitectureContext
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
public TResponse SendQuery<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
public ValueTask PublishAsync<TNotification>(TNotification notification,
CancellationToken cancellationToken = default) where TNotification : INotification
{
throw new NotImplementedException();
throw new NotSupportedException();
}
public IAsyncEnumerable<TResponse> CreateStream<TResponse>(
IStreamRequest<TResponse> request,
CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
public ValueTask SendAsync<TCommand>(TCommand command, CancellationToken cancellationToken = default)
where TCommand : IRequest<Unit>
{
throw new NotImplementedException();
throw new NotSupportedException();
}
public ValueTask<TResponse> SendAsync<TResponse>(IRequest<TResponse> command,
CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
public void SendCommand(ICommand command)

View File

@ -405,7 +405,7 @@ public class TestArchitectureContext : IArchitectureContext
public ValueTask<TResponse> SendRequestAsync<TResponse>(IRequest<TResponse> request,
CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
/// <summary>
@ -417,7 +417,7 @@ public class TestArchitectureContext : IArchitectureContext
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
public TResponse SendRequest<TResponse>(IRequest<TResponse> request)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
/// <summary>
@ -432,7 +432,7 @@ public class TestArchitectureContext : IArchitectureContext
GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command,
CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
/// <summary>
@ -444,7 +444,7 @@ public class TestArchitectureContext : IArchitectureContext
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
public TResponse SendCommand<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
/// <summary>
@ -459,7 +459,7 @@ public class TestArchitectureContext : IArchitectureContext
GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query,
CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
/// <summary>
@ -471,7 +471,7 @@ public class TestArchitectureContext : IArchitectureContext
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
public TResponse SendQuery<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
/// <summary>
@ -485,7 +485,7 @@ public class TestArchitectureContext : IArchitectureContext
public ValueTask PublishAsync<TNotification>(TNotification notification,
CancellationToken cancellationToken = default) where TNotification : INotification
{
throw new NotImplementedException();
throw new NotSupportedException();
}
/// <summary>
@ -500,7 +500,7 @@ public class TestArchitectureContext : IArchitectureContext
IStreamRequest<TResponse> request,
CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
/// <summary>
@ -514,7 +514,7 @@ public class TestArchitectureContext : IArchitectureContext
public ValueTask SendAsync<TCommand>(TCommand command, CancellationToken cancellationToken = default)
where TCommand : IRequest<Unit>
{
throw new NotImplementedException();
throw new NotSupportedException();
}
/// <summary>
@ -528,7 +528,7 @@ public class TestArchitectureContext : IArchitectureContext
public ValueTask<TResponse> SendAsync<TResponse>(IRequest<TResponse> command,
CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
/// <summary>

View File

@ -329,7 +329,7 @@ public class ResultTests
{
// Arrange
var result1 = Result.Failure(new InvalidOperationException("Error"));
var result2 = Result.Failure(new ArgumentException("Error"));
var result2 = Result.Failure(new InvalidCastException("Error"));
// Act & Assert
Assert.That(result1.Equals(result2), Is.False);

View File

@ -20,7 +20,7 @@ public sealed class AsyncTestModel : AbstractModel, IAsyncInitializable
/// <returns>表示异步操作的Task</returns>
public async Task InitializeAsync()
{
await Task.Delay(10);
await Task.Delay(10).ConfigureAwait(false);
Initialized = true;
}
@ -45,4 +45,4 @@ public sealed class AsyncTestModel : AbstractModel, IAsyncInitializable
protected override void OnInit()
{
}
}
}

View File

@ -93,7 +93,7 @@ public class ContextAwareEnvironmentExtensionsTests
return false;
}
public T GetRequired<T>(string key) where T : class => throw new NotImplementedException();
public T GetRequired<T>(string key) where T : class => throw new NotSupportedException();
public void Register(string key, object value)
{
@ -115,7 +115,7 @@ public class ContextAwareEnvironmentExtensionsTests
return false;
}
public T GetRequired<T>(string key) where T : class => throw new NotImplementedException();
public T GetRequired<T>(string key) where T : class => throw new NotSupportedException();
public void Register(string key, object value)
{
@ -129,4 +129,4 @@ public class ContextAwareEnvironmentExtensionsTests
private class TestContextAware : ContextAwareBase
{
}
}
}

View File

@ -16,7 +16,7 @@ public sealed class AsyncTestSystem : ISystem, IAsyncInitializable
public async Task InitializeAsync()
{
await Task.Delay(10);
await Task.Delay(10).ConfigureAwait(false);
Initialized = true;
}
@ -44,4 +44,4 @@ public sealed class AsyncTestSystem : ISystem, IAsyncInitializable
public void OnArchitecturePhase(ArchitecturePhase phase)
{
}
}
}