コード例 #1
0
        public void EnterExitBusyModeTogglesIsBusy()
        {
            var model = new TermListViewModelDraft();

            Assert.AreEqual(false, model.IsBusy);

            model.InvokeEnterBusyMode();
            Assert.AreEqual(true, model.IsBusy);

            model.InvokeExitBusyMode();
            Assert.AreEqual(false, model.IsBusy);
        }
コード例 #2
0
        public void EnterExitBusyModeConsiderNesting()
        {
            var model = new TermListViewModelDraft();

            var busyModeChangeCount = 0;

            model.PropertyChanged += (sender, e) => busyModeChangeCount++;

            // Verify that IsBusy changed only once.
            model.InvokeEnterBusyMode();
            model.InvokeEnterBusyMode();
            model.InvokeEnterBusyMode();
            Assert.AreEqual(1, busyModeChangeCount);

            busyModeChangeCount = 0;

            // Verify that IsBusy changed only once.
            model.InvokeExitBusyMode();
            model.InvokeExitBusyMode();
            model.InvokeExitBusyMode();
            Assert.AreEqual(1, busyModeChangeCount);
        }