public void ShouldReturnTrue() { var command = new MvxAsyncCommand(() => Task.Delay(TimeSpan.FromSeconds(1))); command.Execute(); Assert.IsTrue(command.CancelExecution()); }
public void ShouldCancelCommandExecution() { Setup(); var task = default(Task); var command = new MvxAsyncCommand( cancellationToken => task = Task.Delay(TimeSpan.FromSeconds(1), cancellationToken) ); command.Execute(); command.CancelExecution(); Assert.IsTrue(task.IsCanceled); }
public void ShouldReturnFalse() { var command = new MvxAsyncCommand(() => Task.Delay(TimeSpan.FromMilliseconds(5))); Assert.IsFalse(command.CancelExecution()); }