示例#1
0
        public async Task <object> Get(Guid noteId)
        {
            var query = new Get.Query(User.Identifier(), noteId);

            var result = await _mediator.Send(query);

            return(result);
        }
        public async Task <ActionResult <string> > Get([FromRoute] Guid id)
        {
            var command = new Get.Query(id);

            var response = await _mediator.Send(command);

            return(Ok(response));
        }
示例#3
0
        public async Task <object> OwnedStockDetails(string ticker)
        {
            var query = new Get.Query(ticker);

            query.WithUserId(User.Identifier());

            return(await _mediator.Send(query));
        }
示例#4
0
        public async Task <IActionResult> GetTask(Get.Query query)
        {
            _logger.LogInformation("Start GetTasks query");

            var task = await _mediator.Send(query);

            _logger.LogInformation("End GetTasks query");

            return(Ok(task));
        }
示例#5
0
        public async Task ShouldGetAllMedicationsWhenNoParameters()
        {
            // arrange;
            var query = new Get.Query(null, null);

            // act;
            var res = await SendMediatorRequestInScope(query);

            // assert;
            res.Should().NotBeNullOrEmpty();
        }
示例#6
0
        public async Task ShouldReturnEmptyListIfTheChemicalSubstanceDoesNotExist()
        {
            // arrange;
            const string chemicalSubstance = "LITERALLY_MADE_UP";
            var          query             = new Get.Query(chemicalSubstance, null);

            // act;
            var res = await SendMediatorRequestInScope(query);

            // assert;
            res.Should().BeEmpty();
        }
示例#7
0
        public async Task ShouldReturnFis()
        {
            // arrange;
            var query = new Get.Query();

            // act;
            var res = await SendMediatorRequestInScope(query);

            // assert;
            res.Should()
            .NotBeNullOrEmpty();
        }
示例#8
0
        public async Task ShouldReturnEmptyListIfTheProductNameDoesNotExist()
        {
            // arrange;
            const string productName = "LITERALLY_MADE_UP";
            var          query       = new Get.Query(null, productName);

            // act;
            var res = await SendMediatorRequestInScope(query);

            // assert;
            res.Should().BeEmpty();
        }
示例#9
0
 public async Task<IHttpActionResult> Get(int id)
 {
     // Return a bad request if the query url has no id
     if (id == 0) return BadRequest("id cannot be empty");
     // Create a query object to be passed to the mediator
     var query = new Get.Query() { Id = id };
     // Send an async request through the mediator
     var entity = await _mediator.SendAsync(query);
     // Return not found if the response is empty
     if (entity == null) return NotFound();
     // Return the entity found
     return Ok(entity);
 }
示例#10
0
        public async Task ShouldGetMedicationsWithAGivenSubstanceNameWhenItExists()
        {
            // arrange;
            const string chemicalSubstance = "Budesonide";
            var          query             = new Get.Query(chemicalSubstance, null);

            // act;
            var res = await SendMediatorRequestInScope(query);

            // assert;
            res.Should()
            .NotBeEmpty().And
            .OnlyContain(m => m.BnfChemicalSubstance.Equals(chemicalSubstance));
        }
示例#11
0
        public async Task ShouldGetMedicationsWithAGivenProductNameWhenItExists()
        {
            // arrange;
            const string productName = "Cortiment";
            var          query       = new Get.Query(null, productName);

            // act;
            var res = await SendMediatorRequestInScope(query);

            // assert;
            res.Should()
            .NotBeEmpty().And
            .OnlyContain(m => m.BnfProduct !.Equals(productName));
        }
示例#12
0
        public async Task Get_WorksAsync()
        {
            var storage = _fixture.CreateStorageWithSoldOption();
            var opt     = storage.SavedOptions.First();
            var query   = new Get.Query {
                Id = opt.State.Id
            };

            query.WithUserId(opt.State.UserId);

            var handler = new Get.Handler(storage);

            var result = await handler.Handle(query, CancellationToken.None);

            Assert.NotNull(result);
        }
示例#13
0
        public async Task ShouldGetMedicationsWhenBothValuesValid()
        {
            // arrange;
            const string chemicalSubstance = "Budesonide";
            const string productName       = "Cortiment";
            var          query             = new Get.Query(chemicalSubstance, productName);

            // act;
            var res = await SendMediatorRequestInScope(query);

            // assert;
            res.Should()
            .NotBeEmpty().And
            .OnlyContain(m =>
                         m.BnfProduct !.Equals(productName) && m.BnfChemicalSubstance.Equals(chemicalSubstance));
        }
示例#14
0
        public async Task <object> Get(Guid id)
        {
            var query = new Get.Query {
                Id = id
            };

            query.WithUserId(this.User.Identifier());

            var option = await _mediator.Send(query);

            if (option == null)
            {
                return(NotFound());
            }

            return(option);
        }
示例#15
0
        public async Task <IActionResult> Get([FromRoute] Get.Query query)
        {
            var post = await _mediator.Send(query);

            return(Ok(post));
        }
示例#16
0
        public Task <object> Index()
        {
            var query = new Get.Query(this.User.Identifier());

            return(_mediator.Send(query));
        }
示例#17
0
        public async Task <object> Get(string ticker)
        {
            var query = new Get.Query(User.Identifier(), ticker);

            return(await _mediator.Send(query));
        }
示例#18
0
        public async Task <ActionResult <IEnumerable <AppointmentDto> > > GetMyAppointments([FromQuery] Get.Query query)
        {
            var res = await _mediator.Send(query);

            return(Ok(res));
        }
示例#19
0
        public async Task <ActionResult <IEnumerable <MedicationDto> > > Get([FromQuery] Get.Query query)
        {
            var res = await _mediator.Send(query);

            return(Ok(res));
        }
示例#20
0
 public async Task <ActionResult> Get(Get.Query query)
 {
     return(Ok(await mediator.Send(query)));
 }
示例#21
0
        public Task <PortfolioResponse> Index()
        {
            var query = new Get.Query(User.Identifier());

            return(_mediator.Send(query));
        }
示例#22
0
 public async Task <IHttpActionResult> Ping(Get.Query query) => await Ok(Mediator.Send(query ?? new Get.Query()));
示例#23
0
        public async Task <Game> GetGame([FromRoute] Get.Query query)
        {
            var response = await _mediator.Send(query);

            return(response);
        }