Пример #1
0
        public string PantallaGetTest([PexAssumeUnderTest] CalculadoraVM target)
        {
            string result = target.Pantalla;

            return(result);
            // TODO: agregar aserciones a método CalculadoraVMTest.PantallaGetTest(CalculadoraVM)
        }
Пример #2
0
        public DelegateCommand OperarGetTest([PexAssumeUnderTest] CalculadoraVM target)
        {
            DelegateCommand result = target.Operar;

            return(result);
            // TODO: agregar aserciones a método CalculadoraVMTest.OperarGetTest(CalculadoraVM)
        }
Пример #3
0
        public CalculadoraVM ConstructorTest()
        {
            CalculadoraVM target = new CalculadoraVM();

            return(target);
            // TODO: agregar aserciones a método CalculadoraVMTest.ConstructorTest()
        }
Пример #4
0
        public DelegateCommand AñadirComaDecimalGetTest([PexAssumeUnderTest] CalculadoraVM target)
        {
            DelegateCommand result = target.AñadirComaDecimal;

            return(result);
            // TODO: agregar aserciones a método CalculadoraVMTest.AñadirComaDecimalGetTest(CalculadoraVM)
        }
        public ActionResult Index()
        {
            CalculadoraVM model = new CalculadoraVM();

            model.OperadorA = 10;
            model.OperadorB = 0;
            model.Resultado = null;
            return(View(model));
        }
        public ActionResult Index(CalculadoraVM model, string command)
        {
            if (ModelState.IsValid)
            {
                /* Por bug MVC
                 * bool removeOk = this.ModelState.Remove("resultado");
                 * if (!removeOk) throw new Exception("Error en ModelState.Remove");
                 */

                switch (command)
                {
                case "+":
                    model.Resultado = model.OperadorA + model.OperadorB;
                    break;

                case "-":
                    model.Resultado = model.OperadorA - model.OperadorB;
                    break;

                case "*":
                    model.Resultado = model.OperadorA * model.OperadorB;
                    break;

                case "/":
                    try
                    {
                        model.Resultado = model.OperadorA / model.OperadorB;
                    }
                    catch (DivideByZeroException)
                    {
                        ModelState.AddModelError("OperadorB", "No se puede dividir por cero.");
                    }
                    break;

                default:
                    throw new
                          Exception
                          (
                              string.Format("El comando {0} no existe", command)
                          );
                }
            }

            return(View(model));
        }
Пример #7
0
 public void PantallaSetTest([PexAssumeUnderTest] CalculadoraVM target, string value)
 {
     target.Pantalla = value;
     // TODO: agregar aserciones a método CalculadoraVMTest.PantallaSetTest(CalculadoraVM, String)
 }