Exemplo n.º 1
0
        public async Task Handle_NoMatchingId_ThrowsNotFoundException()
        {
            var query = new GetPatientQuery {
                Id = 3
            };

            var handler = new GetPatientQuery.GetPatientQueryHandler(_context, _mapper);

            Func <Task> action = () => handler.Handle(query, CancellationToken.None);

            await action.Should().ThrowExactlyAsync <NotFoundException>();
        }
Exemplo n.º 2
0
        public async Task Handle_ReturnsCorrectVmAndPatient()
        {
            var query = new GetPatientQuery {
                Id = 1
            };

            var handler = new GetPatientQuery.GetPatientQueryHandler(_context, _mapper);

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

            result.Should().BeOfType <GetPatientVm>();
            result.Id.Should().Be(1);
            result.Honorific.Should().Be(Honorific.Mr);
            result.FirstName.Should().Be("Jay");
        }