public async void CreateLibro()
        {
            // Configure EF to be used in memory for testing purposes
            var options = new DbContextOptionsBuilder <LibreriaContext>()
                          .UseInMemoryDatabase("LibrosDB")
                          .Options;

            var context        = new LibreriaContext(options);
            var rabbitEventBus = new Mock <IRabbitEventBus>();

            rabbitEventBus.Setup(x => x.Publish(new EmailEventQueue("*****@*****.**", "test title", "test content")));

            var request = new NewLibroCommand
            {
                Titulo           = "Libro titulo",
                AutorLibro       = Guid.Empty,
                FechaPublicacion = DateTime.Now
            };
            var handler = new NewLibroCommandHandler(context, rabbitEventBus.Object);

            var result = await handler.Handle(request, new System.Threading.CancellationToken());

            Assert.True(result != null);
        }
Example #2
0
 public GenerosController()
 {
     context = new LibreriaContext();
 }
Example #3
0
 public GetLibroQueryHandler(LibreriaContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public LibroController(LibreriaContext context)
 {
     _context = context;
 }
Example #5
0
 public LibriService(LibreriaContext libreriaContext)
 {
     _libreriaContext = libreriaContext;
 }
 public InicioController()
 {
     libreriaContext = new LibreriaContext();
 }
Example #7
0
 public GeneroController()
 {
     this.context = new LibreriaContext();
 }
 public NewLibroCommandHandler(LibreriaContext context, IRabbitEventBus rabbitEventBus)
 {
     _context        = context;
     _rabbitEventBus = rabbitEventBus;
 }
Example #9
0
 public HomeController(ILogger <HomeController> logger)
 {
     _logger = logger;
     context = new LibreriaContext();
 }
 public AutoresController(LibreriaContext context)
 {
     _context = context;
 }