Exemple #1
0
        public void CanExecuteCalculateCommand()
        {
            CalcViewModel viewModel = new CalcViewModel();

            ICommand command = viewModel.CalcCommand;

            command.Execute(null);
        }
Exemple #2
0
        public void CanInputSum()
        {
            CalcViewModel viewModel = new CalcViewModel();

            viewModel.Input = "1+1";

            Assert.AreEqual("1+1", viewModel.Input);
        }
Exemple #3
0
        public void CanExecuteCalculateCommandFiveTimeSeven()
        {
            CalcViewModel viewModel = new CalcViewModel();

            viewModel.Input = "5*7";

            ICommand command = viewModel.CalcCommand;

            command.Execute(null);

            Assert.AreEqual(35, viewModel.Result);
        }
Exemple #4
0
        public void CanExecuteCalculateCommandTwoPlusTwo()
        {
            CalcViewModel viewModel = new CalcViewModel();

            viewModel.Input = "2+2";

            ICommand command = viewModel.CalcCommand;

            command.Execute(null);

            Assert.AreEqual(4, viewModel.Result);
        }
Exemple #5
0
        public void ResultChangedNotificationIsFired()
        {
            CalcViewModel viewModel = new CalcViewModel();
            bool          hasFired  = false;

            viewModel.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "Result")
                {
                    hasFired = true;
                }
            };
            viewModel.Input = "5*7";
            ICommand command = viewModel.CalcCommand;

            command.Execute(null);
            Assert.IsTrue(hasFired);
        }
Exemple #6
0
 public AddCharCommand(CalcViewModel viewModel)
 {
     this.viewModel = viewModel;
 }
Exemple #7
0
 public CalcCommand(CalcViewModel viewModel)
 {
     this.viewModel = viewModel;
 }
Exemple #8
0
 public OperationCommand(CalcViewModel viewModel)
 {
     this.viewModel = viewModel;
 }
Exemple #9
0
 public DeleteCharCommand(CalcViewModel viewModel)
 {
     this.viewModel = viewModel;
 }
Exemple #10
0
 public void CanCreateViewModel()
 {
     CalcViewModel viewModel = new CalcViewModel();
 }