Beispiel #1
0
        public void ObtenerPuntoIdNoExiste()
        {
            string nombre               = "Este";
            string descripcion          = "Prueba";
            var    repoMock             = new Mock <IRepository <PuntoTuristico> >(MockBehavior.Strict);
            var    repoLogicaCat        = new Mock <ICategoria>(MockBehavior.Strict);
            PuntoTuristico_Logic logica = new PuntoTuristico_Logic(repoMock.Object, repoLogicaCat.Object);
            PuntoTuristico       punto  = logica.PuntoTuristico(nombre, descripcion);

            punto.Id = 1;
            repoMock.Setup(x => x.Get(2)).Throws(new EntidadNoExisteExcepcion());
            Assert.Throws <EntidadNoExisteExcepcion>(() => logica.ObtenerPuntoId(2));
        }
Beispiel #2
0
        public void ObtenerPuntoIdValido()
        {
            string nombre               = "Este";
            string descripcion          = "Prueba";
            var    repoMock             = new Mock <IRepository <PuntoTuristico> >(MockBehavior.Strict);
            var    repoLogicaCat        = new Mock <ICategoria>(MockBehavior.Strict);
            PuntoTuristico_Logic logica = new PuntoTuristico_Logic(repoMock.Object, repoLogicaCat.Object);
            PuntoTuristico       punto  = logica.PuntoTuristico(nombre, descripcion);

            punto.Id = 1;
            repoMock.Setup(x => x.Get(1)).Returns(punto);
            PuntoTuristico resultado = logica.ObtenerPuntoId(1);

            Assert.AreEqual(nombre, resultado.Nombre);
        }