Beispiel #1
0
        public async Task ShouldSubmitPackage()
        {
            var package = _fixture.Generator.CreateCarePackage(PackageType.NursingCare);

            var request = new CarePackageSubmissionRequest
            {
                ApproverId = UserConstants.DefaultApiUserGuid,
                Notes      = "Hello world"
            };

            var response = await _fixture.RestClient
                           .PostAsync <IEnumerable <CarePackageSchedulingOptionResponse> >($"api/v1/care-packages/{package.Id}/submit", request)
                           .ConfigureAwait(false);

            package = _fixture.DatabaseContext.CarePackages
                      .FirstOrDefault(p => p.Id == package.Id);
            var historyEntry = _fixture.DatabaseContext.CarePackageHistories
                               .FirstOrDefault(h => h.CarePackageId == package.Id);

            response.Message.StatusCode.Should().Be(HttpStatusCode.OK);

            package?.Should().NotBeNull();
            package?.Status.Should().Be(PackageStatus.SubmittedForApproval);
            package?.ApproverId.Should().Be(request.ApproverId);

            historyEntry?.Should().NotBeNull();
            historyEntry?.RequestMoreInformation.Should().Be(request.Notes);
            historyEntry?.Description.Should().Be(HistoryStatus.SubmittedForApproval.GetDisplayName());
            historyEntry?.Status.Should().Be(HistoryStatus.SubmittedForApproval);
        }
 public static CarePackageSubmissionDomain ToDomain(this CarePackageSubmissionRequest input)
 {
     return(_mapper.Map <CarePackageSubmissionDomain>(input));
 }
Beispiel #3
0
        public async Task <ActionResult> SubmitForApproval(Guid carePackageId, CarePackageSubmissionRequest request)
        {
            await _submitCarePackageUseCase.ExecuteAsync(carePackageId, request.ToDomain());

            return(Ok());
        }