Skip to content

Commit

Permalink
test: adding test to ensure Exception is handled once
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiegel committed Oct 29, 2023
1 parent a95a91e commit cea90a6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/Prism.Core.Tests/Commands/AsyncDelegateCommandFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,14 @@ public async Task ICommandExecute_UsesDefaultTokenSourceFactory()

Assert.False(command.IsExecuting);
}

[Fact]
public void ICommandExecute_HandlesErrorOnce()
{
var handled = 0;
ICommand command = new AsyncDelegateCommand<string>(str => throw new System.Exception("Test"))
.Catch(ex => handled++);
command.Execute(string.Empty);
Assert.Equal(1, handled);
}
}

0 comments on commit cea90a6

Please sign in to comment.