コード例 #1
0
        public async Task <IActionResult> Get(int id)
        {
            var query = new GetScheduleDetailQuery {
                Id = id
            };

            var result = await _mediator.Send(query);

            return(Ok(result));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }