public void PrestarLibroNoDisponibleTest()
        {
            // Arrange
            Libro libro = new LibroTestDataBuilder().ConTitulo(CRONICA_UNA_MUERTE_ANUNCIADA).Build();

            repositorioLibro.Agregar(libro);
            Bibliotecario bibliotecario = new Bibliotecario(repositorioLibro, repositorioPrestamo);

            // Act
            bibliotecario.Prestar(libro.Isbn, "Juan");
            try
            {
                var esprestado = bibliotecario.EsPrestado(libro.Isbn);

                // Assert
                Assert.AreEqual(esprestado, true);

                /*
                 * bibliotecario.Prestar(libro.Isbn, "Juan");
                 * Assert.Fail();*/
            }
            catch (Exception err)
            {
                // Assert
                Assert.AreEqual("El libro no se encuentra disponible", err.Message);
            }
        }
Beispiel #2
0
        public void LibroNoPrestadoTest()
        {
            var           libroTestDataBuilder = new LibroTestDataBuilder();
            Libro         libro         = libroTestDataBuilder.Build();
            Bibliotecario bibliotecario = new Bibliotecario(repositorioLibro.Object, repositorioPrestamo.Object);

            repositorioPrestamo.Setup(r => r.ObtenerLibroPrestadoPorIsbn(libro.Isbn)).Equals(null);
            var esprestado = bibliotecario.EsPrestado(libro.Isbn);

            Assert.IsFalse(esprestado);
        }
Beispiel #3
0
        public void EsPrestado()
        {
            var   libroTestDataBuilder = new LibroTestDataBuilder();
            Libro libro = libroTestDataBuilder.Build();

            repositorioPrestamo.Setup(r => r.ObtenerLibroPrestadoPorIsbn(libro.Isbn)).Returns(libro);
            Bibliotecario bibliotecario = new Bibliotecario(repositorioLibro.Object, repositorioPrestamo.Object);
            var           esprestado    = bibliotecario.EsPrestado(libro.Isbn);

            Assert.AreEqual(esprestado, true);
        }
Beispiel #4
0
        public void PrestarLibroTest()
        {
            var libro = new LibroTestDataBuilder().ConTitulo(CRONICAUNAMUERTEANUNCIADA).Build();

            _repositorioLibro.Agregar(libro);
            var bibliotecario = new Bibliotecario(_repositorioLibro, _repositorioPrestamo);

            bibliotecario.Prestar(libro.Isbn, "AlbertoPalencia");
            Assert.AreEqual(bibliotecario.EsPrestado(libro.Isbn), true);
            Assert.IsNotNull(_repositorioPrestamo.ObtenerLibroPrestadoPorIsbn(libro.Isbn));
        }
Beispiel #5
0
        public void PrestarLibroTest()
        {
            // Arrange
            Libro libro = new LibroTestDataBuilder().ConTitulo(CRONICA_UNA_MUERTE_ANUNCIADA).Build();

            repositorioLibro.Agregar(libro);
            Bibliotecario bibliotecario = new Bibliotecario(repositorioLibro, repositorioPrestamo);

            // Act
            bibliotecario.Prestar(libro.Isbn, "Juan");

            // Assert
            Assert.AreEqual(bibliotecario.EsPrestado(libro.Isbn), true);
            Assert.IsNotNull(repositorioPrestamo.ObtenerLibroPrestadoPorIsbn(libro.Isbn));
        }
        public void ValidateFechaNula()
        {
            Libro libro = new LibroTestDataBuilder().ConTitulo(CRONICA_UNA_MUERTE_ANUNCIADA).ConIsbn("123456").Build();

            repositorioLibro.Agregar(libro);
            Bibliotecario bibliotecario = new Bibliotecario(repositorioLibro, repositorioPrestamo);

            bibliotecario.Prestar(libro.Isbn, "pedrito");
            Assert.AreEqual(bibliotecario.EsPrestado(libro.Isbn), true);

            /*
             * Prestamo prestamo = repositorioPrestamo.Obtener(libro.Isbn);
             * Assert.AreEqual(null, prestamo.FechaEntregaMaxima);
             */
        }
Beispiel #7
0
        public void PrestarLibroCuandoIsbnEsMayorA30Digitos(string parameter)
        {
            // Arrange
            Libro libro = new LibroTestDataBuilder().ConIsbn(parameter).Build();

            repositorioLibro.Agregar(libro);
            Bibliotecario bibliotecario = new Bibliotecario(repositorioLibro, repositorioPrestamo);

            // Act

            bibliotecario.Prestar(libro.Isbn, "Juan");

            // Assert
            Assert.AreEqual(bibliotecario.EsPrestado(libro.Isbn), true);
            Assert.IsNotNull(repositorioPrestamo.ObtenerLibroPrestadoPorIsbn(libro.Isbn));
        }