예제 #1
0
        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);
        }
예제 #2
0
        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();
        }
예제 #3
0
        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();
        }
예제 #4
0
        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
            });
        }