コード例 #1
0
        public ActionResult InserirPotz(Potz potz)
        {
            CupomPotz cupompotz = new CupomPotz(potz.numeroCupom);

            if (potz.numeroCupom != null)
            {
                if (cupompotz.isValido())
                {
                    cupompotz.quantidadePotz();
                    ViewBag.Valor = "Você recebeu " + cupompotz.getPotz() + " potz!";
                }

                else
                {
                    ViewBag.Valor = "Cupom Inválido";
                }
            }
            return(View());
        }
コード例 #2
0
        public void IsValidoTestTrue()
        {
            CupomPotz cupompotz = new CupomPotz("500036532-7");

            Assert.IsTrue(cupompotz.isValido());
        }
コード例 #3
0
        public void IsValidoTestFalse()
        {
            CupomPotz cupompotz = new CupomPotz("500036532-8");

            Assert.IsFalse(cupompotz.isValido());
        }