Esempio n. 1
0
        public void ZPrestarLibroVerificarFechaIsbnCortoTest()
        {
            // Arrange
            Libro libro = new LibroTestDataBuilder().ConIsbn(ISBN_UNDER30_X)
                          .Build();

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


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


            //Assert
            Assert.IsNull(repositorioPrestamo.Obtener(libro.Isbn).FechaEntregaMaxima);//si no sobre pasa los 30 caracteres, guarda la entrega null
        }
Esempio n. 2
0
        public void SumatoriaNumerosISBNMayorTreintaRetornaFechaMaxima()
        {
            // Arrange
            var libroAplicaFechaMaxima = new Libro(ISBN_FECHA_MAXIMA_PRESTAMO, "Libro con fecha de devolucion", 2012);

            repositorioLibro.Agregar(libroAplicaFechaMaxima);
            var libroNoAplicaFechaMaxima = new Libro(ISBN_SIN_FECHA_MAXIMA_PRESTAMO, "Libro sin fecha de devolucion", 2012);

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

            // Act
            bibliotecario.Prestar(libroAplicaFechaMaxima.Isbn, "Juan");
            bibliotecario.Prestar(libroNoAplicaFechaMaxima.Isbn, "Pedro");
            // Assert

            var prestatamoAplicaFecha   = repositorioPrestamo.Obtener(libroAplicaFechaMaxima.Isbn);
            var prestatamoNoAplicaFecha = repositorioPrestamo.Obtener(libroNoAplicaFechaMaxima.Isbn);

            Assert.IsNotNull(prestatamoAplicaFecha.FechaEntregaMaxima);
            Assert.IsNull(prestatamoNoAplicaFecha.FechaEntregaMaxima);
        }
Esempio n. 3
0
        public void FechaEntregaDiferenteNull()
        {
            // Arrange
            Libro libro = new LibroTestDataBuilder().ConIsbn(ISBN_CON_FECHA_ENTREGA).Build();

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

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

            // Assert
            Prestamo prestamo = repositorioPrestamo.Obtener(ISBN_CON_FECHA_ENTREGA);
            DateTime fechaConDomingosSumados = DateTime.Now.AddDays(15);

            Assert.IsNotNull(prestamo.FechaEntregaMaxima);
            Assert.AreNotEqual(fechaConDomingosSumados, prestamo.FechaEntregaMaxima);
        }