From cea90a643cc4cd7167d79f5016623b88a1521dbf Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 28 Oct 2023 20:06:30 -0600 Subject: [PATCH] test: adding test to ensure Exception is handled once --- .../Commands/AsyncDelegateCommandFixture.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/Prism.Core.Tests/Commands/AsyncDelegateCommandFixture.cs b/tests/Prism.Core.Tests/Commands/AsyncDelegateCommandFixture.cs index 99cda221a3..ff1ef506f8 100644 --- a/tests/Prism.Core.Tests/Commands/AsyncDelegateCommandFixture.cs +++ b/tests/Prism.Core.Tests/Commands/AsyncDelegateCommandFixture.cs @@ -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(str => throw new System.Exception("Test")) + .Catch(ex => handled++); + command.Execute(string.Empty); + Assert.Equal(1, handled); + } }