public async Task BusyIndicatorRaisesPropertyChangeAfterRunAction() { var vm = new ViewModelWithEvents(); #pragma warning disable 1998 await vm.RunWithBusyIndicatorAsync(async() => vm.MonitorEvents()); #pragma warning restore 1998 vm.ShouldRaisePropertyChangeFor(v => v.IsBusy); }
public async Task RunActionIsRunAndReturnsResult() { var vm = new ViewModelWithEvents(); #pragma warning disable 1998 var isRun = await vm.RunWithBusyIndicatorAsync(async() => true); #pragma warning restore 1998 isRun.Should().BeTrue(); }
public async Task RunActionIsRun() { var isRun = false; var vm = new ViewModelWithEvents(); #pragma warning disable 1998 await vm.RunWithBusyIndicatorAsync(async() => #pragma warning restore 1998 { isRun = true; }); isRun.Should().BeTrue(); }
public async Task BusyIndicatorIsToggledAroundRunAction() { var vm = new ViewModelWithEvents(); var busyStates = new List <bool> { vm.IsBusy }; await vm.RunWithBusyIndicatorAsync(async() => { await Task.Delay(100); busyStates.Add(vm.IsBusy); }); busyStates.Add(vm.IsBusy); busyStates.Should().HaveCount(3); busyStates.Should().ContainInOrder(new List <bool> { false, true, false }); }