public AsyncViewModel()
 {
     //this.asyncCommand = DelegateCommand.FromAsyncHandler(this.GetListAsync);
     this.asyncCommandFromHandler = DelegateCommand.FromAsyncHandler(this.LoadHousesAsync);
     this.asyncCommand = new DelegateCommand(this.GetHousesAction); // wrong
     this.asyncCommandOwn = new AsyncCommand(this.LoadHousesAsync);
     
     this.Status = "StartUp";
 }
Exemple #2
0
        public async Task AsyncCommandOwn()
        {
            var vm = new AsyncViewModel();

            var a = new AsyncCommand(null);

            Task executeCommand = vm.AsyncCommandOwn.ExecuteAsync();

            Assert.IsFalse(vm.AsyncCommandOwn.CanExecute());

            await executeCommand;

            Assert.IsTrue(vm.AsyncCommandOwn.CanExecute());
            Assert.AreEqual(vm.Status, "Downloaded 5 houses.");
        }