public async Task <IActionResult> Get(int id) { var query = new GetScheduleDetailQuery { Id = id }; var result = await _mediator.Send(query); return(Ok(result)); }
public void TestGetScheduleDetailQuery_NoData() { var cmd = new GetScheduleDetailQueryHandler(db); var qry = new GetScheduleDetailQuery { Id = 1 }; var cancel = new CancellationToken(); var cqrsResult = cmd.Handle(qry, cancel); Assert.ThrowsException <AggregateException>(() => cqrsResult.Result); }
public void TestGetScheduleDetailQuery_WithData() { var cmd = new GetScheduleDetailQueryHandler(db); var qry = new GetScheduleDetailQuery { Id = 1 }; var cancel = new CancellationToken(); var cqrsResult = cmd.Handle(qry, cancel); Assert.IsTrue(cqrsResult.Result.ScheduleId == 1); }