public async Task ExecuteNotifiesCanExecuteChanged() { var count = 0; var tcs = new TaskCompletionSource <int>(); using (var command = new AsyncCommand(() => tcs.Task)) { command.CanExecuteChanged += (_, __) => count++; var isExecutingCount = 0; using (command.ObservePropertyChangedSlim(nameof(command.IsExecuting), signalInitial: false) .Subscribe(_ => isExecutingCount++)) { Assert.AreEqual(0, isExecutingCount); Assert.IsFalse(command.IsExecuting); Assert.IsFalse(command.CancelCommand.CanExecute()); command.Execute(); Assert.AreEqual(1, isExecutingCount); Assert.IsTrue(command.IsExecuting); Assert.IsFalse(command.CancelCommand.CanExecute()); Assert.AreEqual(1, count); tcs.SetResult(1); await command.Execution.Task.ConfigureAwait(false); Assert.AreEqual(2, isExecutingCount); Assert.IsFalse(command.IsExecuting); Assert.AreEqual(2, count); } } }