Пример #1
0
        public async Task CreateBook()
        {
            // when Debugging is required, System.Diagnostics.Debugger.Launch();

            var options = new DbContextOptionsBuilder <LibraryMaterialContext>()
                          .UseInMemoryDatabase(databaseName: "BookStore")
                          .Options;


            var context = new LibraryMaterialContext(options);
            var request = new Create.Execute();

            request.Title          = "Net Core Micro-services";
            request.BookAuthorGuid = Guid.Empty;
            request.PublishDate    = DateTime.Now;

            var handler = new Create.Handler(context);
            var result  = await handler.Handle(request, new CancellationToken());

            Assert.True(result != null);
        }
Пример #2
0
 public async Task <ActionResult <Unit> > Insert(Create.Execute teacher)
 {
     return(await Mediator.Send(teacher));
 }
Пример #3
0
 public async Task <ActionResult <Unit> > Create(Create.Execute request)
 {
     return(await _mediator.Send(request));
 }
Пример #4
0
 public async Task <ActionResult <Unit> > Insert(Create.Execute comment)
 {
     return(await Mediator.Send(comment));
 }