Пример #1
0
        public async Task ShouldUpdateCareCharges()
        {
            var package = _generator.CreateCarePackage();

            5.Times(_ => _generator.CreateCarePackageReclaim(package, ClaimCollector.Supplier, ReclaimType.CareCharge));

            var request = new CareChargeReclaimBulkUpdateRequest()
            {
                AssessmentFile   = null,
                AssessmentFileId = Guid.NewGuid(),
                Reclaims         = new List <CareChargeReclaimUpdateRequest>()
            };

            var careChargeRequest = new List <CareChargeReclaimUpdateRequest>();

            3.Times(i =>
            {
                var reclaim = package.Reclaims.ElementAt(i);

                careChargeRequest.Add(new CareChargeReclaimUpdateRequest
                {
                    Id             = reclaim.Id,
                    Cost           = reclaim.Cost + 12.34m,
                    ClaimCollector = ClaimCollector.Hackney
                });
            });

            request.Reclaims.AddRange(careChargeRequest);

            var response = await _fixture.RestClient
                           .UpdateFormAsync <IEnumerable <CarePackageReclaimResponse> >(
                $"api/v1/care-packages/{package.Id}/reclaims/care-charges", request);

            var reclaims = _fixture.DatabaseContext.CarePackageReclaims
                           .Where(r => r.CarePackageId == package.Id)
                           .ToList();

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

            reclaims.Count.Should().Be(5 + 3);
            reclaims
            .Where(reclaim => request.Reclaims.Any(requestedReclaim => requestedReclaim.Id == reclaim.Id))
            .Should().OnlyContain(r => r.Status == ReclaimStatus.Ended);
        }
Пример #2
0
 public static CareChargeReclaimBulkUpdateDomain ToDomain(this CareChargeReclaimBulkUpdateRequest careChargeReclaimBulkUpdateRequest)
 {
     return(_mapper.Map <CareChargeReclaimBulkUpdateDomain>(careChargeReclaimBulkUpdateRequest));
 }