Пример #1
0
        public async void CreateBook()
        {
            System.Diagnostics.Debugger.Launch();
            var options = new DbContextOptionsBuilder <BookContext>().UseInMemoryDatabase(databaseName: "BooksDataBase").Options;

            var context = new BookContext(options);

            var request = new New.Execute();

            request.Title       = "Microservice Test Book";
            request.AuthorBook  = Guid.Empty;
            request.ReleaseDate = DateTime.Now;

            var handler = new New.Handler(context);

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

            Assert.True(book != null);
        }
Пример #2
0
        public async void BookInsert()
        {
            var options = new DbContextOptionsBuilder <LibraryContext>()
                          .UseInMemoryDatabase(databaseName: "DataBaseBook")
                          .Options;
            var context = new LibraryContext(options);

            var request = new New.Execute();

            request.Title           = "Libro de Microservicios";
            request.BookAuthor      = Guid.Empty;
            request.DatePublication = DateTime.Now;

            var handler = new New.Handler(context);

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

            Assert.True(book != null);
        }
Пример #3
0
 public async Task <ActionResult <Unit> > Create(New.Execute data)
 {
     return(await _mediator.Send(data));
 }
 public async Task <ActionResult <Unit> > Create(New.Execute request)
 {
     return(await _mediator.Send(request));
 }