public async Task _ExecutionFailed([NotNull] CommandBaseTests.TestArgs <AsyncCommand <int> > args) { args.UpdateReentrancyContainer(3); Assert.IsNull(args.Command.RunningExecution); Assert.IsNull(args.Command.CompletedExecution); await args.Command.Execute(0); CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Faulted, false, true); ((ICommand)args.Command).Execute(0); while (args.Command.RunningExecution != null) { await Task.Delay(100); } CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Faulted, false, true); args.Command.StartExecute(0); while (args.Command.RunningExecution != null) { await Task.Delay(100); } CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Faulted, false, true); CommandBaseTests.CanExecuteChanged(args.Command); }
public async Task _ExecutionSuccessful([NotNull] CommandBaseTests.TestArgs <AsyncCommand> args) { Assert.AreEqual(args.IsCancelCommandEnabled, args.Command.Options.IsCancelCommandEnabled); Assert.AreEqual(args.CanExecute, args.Command.CanExecute()); Assert.AreEqual(args.CanExecute, ((ICommand)args.Command).CanExecute(null)); args.UpdateReentrancyContainer(3); Assert.IsNull(args.Command.RunningExecution); Assert.IsNull(args.Command.CompletedExecution); await args.Command.Execute(); CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Done, true, false); ((ICommand)args.Command).Execute(null); while (args.Command.RunningExecution != null) { await Task.Delay(100); } CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Done, true, false); args.Command.StartExecute(); while (args.Command.RunningExecution != null) { await Task.Delay(100); } CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Done, true, false); CommandBaseTests.CanExecuteChanged(args.Command); }
public void _ExecutionFailed([NotNull] CommandBaseTests.TestArgs <Command <int> > args) { args.UpdateReentrancyContainer(2); Assert.IsNull(args.Command.RunningExecution); Assert.IsNull(args.Command.CompletedExecution); args.Command.Execute(0); CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Faulted, false, true); ((ICommand)args.Command).Execute(0); CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Faulted, false, true); CommandBaseTests.CanExecuteChanged(args.Command); }
static async Task _ExecutionSuccessful <T>([NotNull] CommandBaseTests.TestArgs <AsyncCommand <T> > args, int nonGenericExecutionCount) { Assert.AreEqual(args.IsCancelCommandEnabled, args.Command.Options.IsCancelCommandEnabled); Assert.AreEqual(args.CanExecute, args.Command.CanExecute(default(T))); args.UpdateReentrancyContainer(1 + nonGenericExecutionCount + 1); Assert.IsNull(args.Command.RunningExecution); Assert.IsNull(args.Command.CompletedExecution); await args.Command.Execute(default(T)); CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Done, true, false); ((ICommand)args.Command).Execute(0); while (args.Command.RunningExecution != null) { await Task.Delay(100); } CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Done, true, false); ((ICommand)args.Command).Execute(null); while (args.Command.RunningExecution != null) { await Task.Delay(100); } CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Done, true, false); ((ICommand)args.Command).Execute(""); while (args.Command.RunningExecution != null) { await Task.Delay(100); } CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Done, true, false); args.Command.StartExecute(default(T)); while (args.Command.RunningExecution != null) { await Task.Delay(100); } CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Done, true, false); CommandBaseTests.CanExecuteChanged(args.Command); }
public void _ExecutionSuccessful([NotNull] CommandBaseTests.TestArgs <Command> args) { Assert.AreEqual(args.IsCancelCommandEnabled, args.Command.Options.IsCancelCommandEnabled); Assert.AreEqual(args.CanExecute, args.Command.CanExecute()); Assert.AreEqual(args.CanExecute, ((ICommand)args.Command).CanExecute(null)); args.UpdateReentrancyContainer(2); Assert.IsNull(args.Command.RunningExecution); Assert.IsNull(args.Command.CompletedExecution); args.Command.Execute(); CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Done, true, false); ((ICommand)args.Command).Execute(null); CommandBaseTests.AssertExecutionsAfterCompletion(args, CompletedCommandExecutionState.Done, true, false); CommandBaseTests.CanExecuteChanged(args.Command); }