修复测试用例错误
This commit is contained in:
@@ -42,7 +42,7 @@ namespace XplorePlane.Tests.Pipeline
|
||||
var result = await _svc.ExecutePipelineAsync(
|
||||
Enumerable.Empty<PipelineNodeViewModel>(), _testBitmap);
|
||||
|
||||
Assert.Same(_testBitmap, result);
|
||||
Assert.Same(_testBitmap, result.Image);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -50,7 +50,7 @@ namespace XplorePlane.Tests.Pipeline
|
||||
{
|
||||
var result = await _svc.ExecutePipelineAsync(null!, _testBitmap);
|
||||
|
||||
Assert.Same(_testBitmap, result);
|
||||
Assert.Same(_testBitmap, result.Image);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -59,7 +59,7 @@ namespace XplorePlane.Tests.Pipeline
|
||||
var nodes = new[] { MakeNode("Blur", 0, enabled: false) };
|
||||
var result = await _svc.ExecutePipelineAsync(nodes, _testBitmap);
|
||||
|
||||
Assert.Same(_testBitmap, result);
|
||||
Assert.Same(_testBitmap, result.Image);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -74,8 +74,8 @@ namespace XplorePlane.Tests.Pipeline
|
||||
[Fact]
|
||||
public async Task CancelledToken_ThrowsOperationCanceledException()
|
||||
{
|
||||
// 让 ProcessImageAsync 在执行时检查取消令牌
|
||||
_mockImageSvc.Setup(s => s.ProcessImageAsync(
|
||||
// 让 ProcessImageWithOutputAsync 在执行时检查取消令牌
|
||||
_mockImageSvc.Setup(s => s.ProcessImageWithOutputAsync(
|
||||
It.IsAny<BitmapSource>(),
|
||||
It.IsAny<string>(),
|
||||
It.IsAny<IDictionary<string, object>>(),
|
||||
@@ -85,7 +85,7 @@ namespace XplorePlane.Tests.Pipeline
|
||||
(src, _, _, _, ct) =>
|
||||
{
|
||||
ct.ThrowIfCancellationRequested();
|
||||
return Task.FromResult(src);
|
||||
return Task.FromResult<(BitmapSource, IReadOnlyDictionary<string, object>)>((src, null));
|
||||
});
|
||||
|
||||
using var cts = new CancellationTokenSource();
|
||||
@@ -108,8 +108,8 @@ namespace XplorePlane.Tests.Pipeline
|
||||
await Assert.ThrowsAsync<OperationCanceledException>(
|
||||
() => _svc.ExecutePipelineAsync(nodes, _testBitmap, cancellationToken: cts.Token));
|
||||
|
||||
// ProcessImageAsync 不应被调用
|
||||
_mockImageSvc.Verify(s => s.ProcessImageAsync(
|
||||
// ProcessImageWithOutputAsync 不应被调用
|
||||
_mockImageSvc.Verify(s => s.ProcessImageWithOutputAsync(
|
||||
It.IsAny<BitmapSource>(),
|
||||
It.IsAny<string>(),
|
||||
It.IsAny<IDictionary<string, object>>(),
|
||||
@@ -122,7 +122,7 @@ namespace XplorePlane.Tests.Pipeline
|
||||
[Fact]
|
||||
public async Task NodeThrows_WrappedAsPipelineExecutionException()
|
||||
{
|
||||
_mockImageSvc.Setup(s => s.ProcessImageAsync(
|
||||
_mockImageSvc.Setup(s => s.ProcessImageWithOutputAsync(
|
||||
It.IsAny<BitmapSource>(),
|
||||
"Blur",
|
||||
It.IsAny<IDictionary<string, object>>(),
|
||||
@@ -142,13 +142,13 @@ namespace XplorePlane.Tests.Pipeline
|
||||
[Fact]
|
||||
public async Task NodeReturnsNull_ThrowsPipelineExecutionException()
|
||||
{
|
||||
_mockImageSvc.Setup(s => s.ProcessImageAsync(
|
||||
_mockImageSvc.Setup(s => s.ProcessImageWithOutputAsync(
|
||||
It.IsAny<BitmapSource>(),
|
||||
It.IsAny<string>(),
|
||||
It.IsAny<IDictionary<string, object>>(),
|
||||
It.IsAny<IProgress<double>>(),
|
||||
It.IsAny<CancellationToken>()))
|
||||
.ReturnsAsync((BitmapSource?)null);
|
||||
.ReturnsAsync(((BitmapSource)null, (IReadOnlyDictionary<string, object>)null));
|
||||
|
||||
var nodes = new[] { MakeNode("Blur", 0) };
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace XplorePlane.Tests.Pipeline
|
||||
public async Task Nodes_ExecutedInOrderAscending()
|
||||
{
|
||||
var executionOrder = new List<string>();
|
||||
_mockImageSvc.Setup(s => s.ProcessImageAsync(
|
||||
_mockImageSvc.Setup(s => s.ProcessImageWithOutputAsync(
|
||||
It.IsAny<BitmapSource>(),
|
||||
It.IsAny<string>(),
|
||||
It.IsAny<IDictionary<string, object>>(),
|
||||
@@ -196,7 +196,7 @@ namespace XplorePlane.Tests.Pipeline
|
||||
(src, key, _, _, _) =>
|
||||
{
|
||||
executionOrder.Add(key);
|
||||
return Task.FromResult(src);
|
||||
return Task.FromResult<(BitmapSource, IReadOnlyDictionary<string, object>)>((src, null));
|
||||
});
|
||||
|
||||
// 故意乱序传入
|
||||
|
||||
Reference in New Issue
Block a user