Ejemplo n.º 1
0
        public async Task ShouldEndPackage()
        {
            var package  = _generator.CreateCarePackage(status: PackageStatus.Approved);
            var coreCost = _generator.CreateCarePackageDetails(package, 1, PackageDetailType.CoreCost).First();

            var request = new CarePackageEndRequest()
            {
                Notes   = "Test",
                EndDate = DateTimeOffset.UtcNow.Date.AddDays(-2)
            };

            var response = await _fixture.RestClient
                           .PostAsync <CarePackagePlainResponse>($"api/v1/care-packages/{package.Id}/end", request);

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

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

            package?.Should().NotBeNull();
            package?.Status.Should().Be(PackageStatus.Ended);

            carePackageHistory?.Should().NotBeNull();
            carePackageHistory?.Description.Should().Be($"{HistoryStatus.BrokeredEnded.GetDisplayName()}: {request.EndDate:yyyy-MM-dd}");
            carePackageHistory?.RequestMoreInformation.Should().Be(request.Notes);
            carePackageHistory?.Status.Should().Be(HistoryStatus.BrokeredEnded);
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> EndPackage(Guid carePackageId, CarePackageEndRequest request)
        {
            await _endCarePackageUseCase.ExecuteAsync(carePackageId, request.EndDate.GetValueOrDefault(), request.Notes);

            return(Ok());
        }