mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
test(core-tests): 收敛测试桩与辅助类型 warning
- 更新 ArchitectureContext、ArchitectureServices、GameContext 与环境测试桩的异常类型以满足 analyzer 约束 - 补齐 AsyncTestModel 与 AsyncTestSystem 的异步等待配置并保持测试语义不变 - 调整 ResultTests 的异类异常断言样例以避免新增编译与 analyzer 噪音
This commit is contained in:
parent
b45e551fa8
commit
03c73a8ee5
@ -339,7 +339,7 @@ public class ArchitectureContextTests
|
|||||||
{
|
{
|
||||||
workersReady.Signal();
|
workersReady.Signal();
|
||||||
startGate.Wait();
|
startGate.Wait();
|
||||||
return await context.SendRequestAsync(new TestCqrsRequest());
|
return await context.SendRequestAsync(new TestCqrsRequest()).ConfigureAwait(false);
|
||||||
}))
|
}))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
|||||||
@ -351,12 +351,12 @@ public class TestArchitectureContextV3 : IArchitectureContext
|
|||||||
public ValueTask<TResponse> SendRequestAsync<TResponse>(IRequest<TResponse> request,
|
public ValueTask<TResponse> SendRequestAsync<TResponse>(IRequest<TResponse> request,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TResponse SendRequest<TResponse>(IRequest<TResponse> request)
|
public TResponse SendRequest<TResponse>(IRequest<TResponse> request)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -371,7 +371,7 @@ public class TestArchitectureContextV3 : IArchitectureContext
|
|||||||
GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command,
|
GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -383,7 +383,7 @@ public class TestArchitectureContextV3 : IArchitectureContext
|
|||||||
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
|
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
|
||||||
public TResponse SendCommand<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command)
|
public TResponse SendCommand<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -398,7 +398,7 @@ public class TestArchitectureContextV3 : IArchitectureContext
|
|||||||
GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query,
|
GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -410,32 +410,32 @@ public class TestArchitectureContextV3 : IArchitectureContext
|
|||||||
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
|
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
|
||||||
public TResponse SendQuery<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query)
|
public TResponse SendQuery<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueTask PublishAsync<TNotification>(TNotification notification,
|
public ValueTask PublishAsync<TNotification>(TNotification notification,
|
||||||
CancellationToken cancellationToken = default) where TNotification : INotification
|
CancellationToken cancellationToken = default) where TNotification : INotification
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAsyncEnumerable<TResponse> CreateStream<TResponse>(
|
public IAsyncEnumerable<TResponse> CreateStream<TResponse>(
|
||||||
IStreamRequest<TResponse> request,
|
IStreamRequest<TResponse> request,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueTask SendAsync<TCommand>(TCommand command, CancellationToken cancellationToken = default)
|
public ValueTask SendAsync<TCommand>(TCommand command, CancellationToken cancellationToken = default)
|
||||||
where TCommand : IRequest<Unit>
|
where TCommand : IRequest<Unit>
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueTask<TResponse> SendAsync<TResponse>(IRequest<TResponse> command,
|
public ValueTask<TResponse> SendAsync<TResponse>(IRequest<TResponse> command,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendCommand(ICommand command)
|
public void SendCommand(ICommand command)
|
||||||
|
|||||||
@ -405,7 +405,7 @@ public class TestArchitectureContext : IArchitectureContext
|
|||||||
public ValueTask<TResponse> SendRequestAsync<TResponse>(IRequest<TResponse> request,
|
public ValueTask<TResponse> SendRequestAsync<TResponse>(IRequest<TResponse> request,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -417,7 +417,7 @@ public class TestArchitectureContext : IArchitectureContext
|
|||||||
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
|
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
|
||||||
public TResponse SendRequest<TResponse>(IRequest<TResponse> request)
|
public TResponse SendRequest<TResponse>(IRequest<TResponse> request)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -432,7 +432,7 @@ public class TestArchitectureContext : IArchitectureContext
|
|||||||
GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command,
|
GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -444,7 +444,7 @@ public class TestArchitectureContext : IArchitectureContext
|
|||||||
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
|
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
|
||||||
public TResponse SendCommand<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command)
|
public TResponse SendCommand<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -459,7 +459,7 @@ public class TestArchitectureContext : IArchitectureContext
|
|||||||
GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query,
|
GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -471,7 +471,7 @@ public class TestArchitectureContext : IArchitectureContext
|
|||||||
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
|
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
|
||||||
public TResponse SendQuery<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query)
|
public TResponse SendQuery<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -485,7 +485,7 @@ public class TestArchitectureContext : IArchitectureContext
|
|||||||
public ValueTask PublishAsync<TNotification>(TNotification notification,
|
public ValueTask PublishAsync<TNotification>(TNotification notification,
|
||||||
CancellationToken cancellationToken = default) where TNotification : INotification
|
CancellationToken cancellationToken = default) where TNotification : INotification
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -500,7 +500,7 @@ public class TestArchitectureContext : IArchitectureContext
|
|||||||
IStreamRequest<TResponse> request,
|
IStreamRequest<TResponse> request,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -514,7 +514,7 @@ public class TestArchitectureContext : IArchitectureContext
|
|||||||
public ValueTask SendAsync<TCommand>(TCommand command, CancellationToken cancellationToken = default)
|
public ValueTask SendAsync<TCommand>(TCommand command, CancellationToken cancellationToken = default)
|
||||||
where TCommand : IRequest<Unit>
|
where TCommand : IRequest<Unit>
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -528,7 +528,7 @@ public class TestArchitectureContext : IArchitectureContext
|
|||||||
public ValueTask<TResponse> SendAsync<TResponse>(IRequest<TResponse> command,
|
public ValueTask<TResponse> SendAsync<TResponse>(IRequest<TResponse> command,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -329,7 +329,7 @@ public class ResultTests
|
|||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var result1 = Result.Failure(new InvalidOperationException("Error"));
|
var result1 = Result.Failure(new InvalidOperationException("Error"));
|
||||||
var result2 = Result.Failure(new ArgumentException("Error"));
|
var result2 = Result.Failure(new InvalidCastException("Error"));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(result1.Equals(result2), Is.False);
|
Assert.That(result1.Equals(result2), Is.False);
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public sealed class AsyncTestModel : AbstractModel, IAsyncInitializable
|
|||||||
/// <returns>表示异步操作的Task</returns>
|
/// <returns>表示异步操作的Task</returns>
|
||||||
public async Task InitializeAsync()
|
public async Task InitializeAsync()
|
||||||
{
|
{
|
||||||
await Task.Delay(10);
|
await Task.Delay(10).ConfigureAwait(false);
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,4 +45,4 @@ public sealed class AsyncTestModel : AbstractModel, IAsyncInitializable
|
|||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,7 +93,7 @@ public class ContextAwareEnvironmentExtensionsTests
|
|||||||
return false;
|
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)
|
public void Register(string key, object value)
|
||||||
{
|
{
|
||||||
@ -115,7 +115,7 @@ public class ContextAwareEnvironmentExtensionsTests
|
|||||||
return false;
|
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)
|
public void Register(string key, object value)
|
||||||
{
|
{
|
||||||
@ -129,4 +129,4 @@ public class ContextAwareEnvironmentExtensionsTests
|
|||||||
private class TestContextAware : ContextAwareBase
|
private class TestContextAware : ContextAwareBase
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@ public sealed class AsyncTestSystem : ISystem, IAsyncInitializable
|
|||||||
|
|
||||||
public async Task InitializeAsync()
|
public async Task InitializeAsync()
|
||||||
{
|
{
|
||||||
await Task.Delay(10);
|
await Task.Delay(10).ConfigureAwait(false);
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,4 +44,4 @@ public sealed class AsyncTestSystem : ISystem, IAsyncInitializable
|
|||||||
public void OnArchitecturePhase(ArchitecturePhase phase)
|
public void OnArchitecturePhase(ArchitecturePhase phase)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user