Exemplo n.º 1
0
        public async Task ReturnLectorDetailModel_WhenLectorExists()
        {
            var handler = new GetLectorDetailQueryHandler(Context);

            var result = await handler.Handle(new GetLectorDetailQuery { Id = 1 }, CancellationToken.None);

            Assert.IsInstanceOf(typeof(LectorDetailModel), result);
        }
Exemplo n.º 2
0
        public async Task ThrowNotFoundException_WhenLectorIsNotExists()
        {
            var notExistingLectorId = 1000;
            var handler             = new GetLectorDetailQueryHandler(Context);

            var exception = Assert.ThrowsAsync <NotFoundException>(async() => await handler.Handle(new GetLectorDetailQuery {
                Id = notExistingLectorId
            }, CancellationToken.None));

            Assert.AreEqual(exception.Message, ExceptionMessagesBuilderHelper.GetNotFoundExceptionMessage(nameof(Lector), notExistingLectorId));
        }