예제 #1
0
        public void Get_Frase_Dia()
        {
            // Arrange
            var frase = new Frase
            {
                Id        = 1,
                Texto     = "El testing es un belleza",
                Autor     = "Juan David Pareja Soto",
                Categoria = new Categoria
                {
                    Id     = 1,
                    Nombre = "Frases Motivacionales"
                },
                Fecha = new DateTime(2019, 10, 25)
            };

            var context   = new Mock <QuoteDbContext>();
            var dbSetMock = ServiceTestsHelper.GetMockDbSet <Frase>(frase);

            context.Setup(x => x.Set <Frase>()).Returns(dbSetMock.Object);
            var repository = new Repository <Frase>(context.Object);

            // Act
            var service  = new QuoteService(repository);
            var fraseDia = service.GetByDate(new DateTime(2019, 10, 25));


            //Assert
            Assert.Equal(frase, fraseDia);
        }