Exemple #1
0
        public void MainViewModel_TestIsBusy_ShouldSwitch()
        {
            const double testValue  = 1234.5;
            const int    trendValue = 0;

            _propertyChangedIsBusyWasCalled = false;

            var service = new TestCoinService(testValue, trendValue);

            var vm = new MainViewModel(service);

            var raiseCanExecuteChangedWasCalled = false;

            vm.PropertyChanged += MainViewModelPropertyChanged;

            vm.RefreshCommand.CanExecuteChanged += (s, e) =>
            {
                raiseCanExecuteChangedWasCalled = true;
            };

            Assert.IsFalse(vm.IsBusy);

            vm.RefreshCommand.Execute(null);

            Assert.IsTrue(raiseCanExecuteChangedWasCalled);
            Assert.IsTrue(_propertyChangedIsBusyWasCalled);
            Assert.IsFalse(vm.IsBusy);
        }
Exemple #2
0
        public void MainViewModel_TestTrend_ShouldBeFlat()
        {
            const double testValue  = 1234.5;
            const int    trendValue = 0;

            _propertyChangedEthWasCalled = false;
            _propertyChangedBtcWasCalled = false;

            var service = new TestCoinService(testValue, trendValue);

            var vm = new MainViewModel(service);

            vm.PropertyChanged += MainViewModelPropertyChanged;
            vm.RefreshCommand.Execute(null);

            Assert.IsTrue(_propertyChangedBtcWasCalled);
            Assert.IsTrue(_propertyChangedEthWasCalled);

            Assert.IsFalse(vm.Btc.IsUpTrendVisible);
            Assert.IsTrue(vm.Btc.IsFlatTrendVisible);
            Assert.IsFalse(vm.Btc.IsDownTrendVisible);

            Assert.IsFalse(vm.Eth.IsUpTrendVisible);
            Assert.IsTrue(vm.Eth.IsFlatTrendVisible);
            Assert.IsFalse(vm.Eth.IsDownTrendVisible);
        }
Exemple #3
0
        public void MainViewModel_TestCurrentValue_ShouldBeSet()
        {
            const double testValue  = 1234.5;
            const int    trendValue = 0;

            _propertyChangedEthWasCalled = false;
            _propertyChangedBtcWasCalled = false;

            var service = new TestCoinService(testValue, trendValue);

            var vm = new MainViewModel(service);

            vm.PropertyChanged += MainViewModelPropertyChanged;

            vm.RefreshCommand.Execute(null);

            Assert.AreEqual(testValue, vm.Btc.Model.CurrentValue);
            Assert.AreEqual(testValue, vm.Eth.Model.CurrentValue);
        }