예제 #1
0
        public void CalcularFechaMaximaEntregaTest()
        {
            Libro libro = new LibroTestDataBuilder().ConTitulo("Decisiones, la vida continua").ConIsbn("T878B85Z").Build();

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

            var fechaPrestamo       = new DateTime(2017, 5, 26);
            var fechaMaximaEsperada = new DateTime(2017, 6, 12);
            var fechaEntregaMaxima  = bibliotecario.CalcularFechaEntregaMaxima(isbn: libro.Isbn, fechaPrestamo: fechaPrestamo);

            Assert.AreEqual(fechaEntregaMaxima, fechaMaximaEsperada);
        }
예제 #2
0
        public void CalcularFechaMaximaTest()
        {
            DateTime fechaEntregaCorrecta   = new DateTime();
            int      DIAS_MAXIMO_DE_ENTREGA = 15;
            string   isbn = "9UH76J899789";

            for (int k = 1; k < DIAS_MAXIMO_DE_ENTREGA; k++)
            {
                while (fechaEntregaCorrecta.DayOfWeek == DayOfWeek.Sunday)
                {
                    fechaEntregaCorrecta = fechaEntregaCorrecta.AddDays(1);
                }
                fechaEntregaCorrecta = fechaEntregaCorrecta.AddDays(1);
            }

            Assert.Equals(Bibliotecario.CalcularFechaEntregaMaxima(isbn), fechaEntregaCorrecta);
        }