Exemplo n.º 1
0
        public async Task ShouldEndReclaim()
        {
            var package = TestDataHelper.CreateCarePackage(packageType: PackageType.ResidentialCare,
                                                           status: PackageStatus.Approved);
            var coreCost = TestDataHelper.CreateCarePackageDetail(package.Id, PackageDetailType.CoreCost);

            package.Details.Add(coreCost);
            package.Reclaims.Add(TestDataHelper.CreateCarePackageReclaim(package.Id, type: ReclaimType.CareCharge,
                                                                         subType: ReclaimSubType.CareChargeProvisional, collector: ClaimCollector.Supplier,
                                                                         startDate: coreCost.StartDate, endDate: coreCost.EndDate, cost: 10M));
            package = _generator.CreateCarePackage(package);

            var reclaim = package.Reclaims.First();

            var endDate = DateTimeOffset.UtcNow;

            var response = await _fixture.RestClient
                           .PutAsync <CarePackageReclaimResponse>(
                $"api/v1/care-packages/{package.Id}/reclaims/care-charges/{reclaim.Id}/end",
                new CarePackageReclaimEndRequest { EndDate = endDate });

            reclaim = _fixture.DatabaseContext.CarePackageReclaims.First(r => r.Id == reclaim.Id);

            response.Message.StatusCode.Should().Be(HttpStatusCode.OK);
            response.Content.Status.Should().Be(ReclaimStatus.Ended);

            reclaim.Status.Should().Be(ReclaimStatus.Ended);
            reclaim.EndDate.Value.Date.Should().Be(endDate.Date);
        }
Exemplo n.º 2
0
        public async Task ShouldCreateNewCareCharge()
        {
            var package = TestDataHelper.CreateCarePackage(packageType: PackageType.ResidentialCare,
                                                           status: PackageStatus.Approved);

            package.Settings = TestDataHelper.CreateCarePackageSettings(carePackageId: package.Id, isS117Client: false);
            package.Details.Add(
                TestDataHelper.CreateCarePackageDetail(package.Id, type: PackageDetailType.CoreCost, cost: 100M));

            package = _generator.CreateCarePackage(package);

            var request = new CareChargesCreationRequest()
            {
                CareCharges = new List <CareChargeReclaimCreationRequest>()
                {
                    new CareChargeReclaimCreationRequest()
                    {
                        Cost           = 12.34m,
                        ClaimCollector = ClaimCollector.Hackney,
                        SubType        = ReclaimSubType.CareCharge1To12Weeks,
                        StartDate      = package.Details.First().StartDate,
                        EndDate        = package.Details.First().StartDate.AddDays(83),
                        Description    = "test",
                        ClaimReason    = "test",
                        CarePackageId  = package.Id
                    }
                }
            };

            var response = await _fixture.RestClient
                           .PutAsync <object>($"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(1);
            //reclaims.Should().ContainSingle(r => r.Cost == request.Cost);
        }
Exemplo n.º 3
0
 public static CarePackage AddOneOffNeed(this CarePackage package, decimal?cost = null, DateTimeOffset?startDate = null, DateTimeOffset?endDate = null)
 {
     package.Details.Add(TestDataHelper.CreateCarePackageDetail(package.Id, PackageDetailType.AdditionalNeed, cost, startDate, endDate, PaymentPeriod.OneOff));
     return(package);
 }
Exemplo n.º 4
0
 public static CarePackage AddCoreCost(this CarePackage package, decimal?cost = null, DateTimeOffset?startDate = null, DateTimeOffset?endDate = null)
 {
     package.Details.Add(TestDataHelper.CreateCarePackageDetail(package.Id, PackageDetailType.CoreCost, cost, startDate, endDate, PaymentPeriod.Weekly));
     return(package);
 }