Exemplo n.º 1
0
 public static ResidentSupportAnnexResponse ToResponse(this ResidentSupportAnnex resident)
 {
     return(new ResidentSupportAnnexResponse
     {
         Id = resident.Id,
         IsDuplicate = resident.IsDuplicate,
         OngoingFoodNeed = resident.OngoingFoodNeed,
         OngoingPrescriptionNeed = resident.OngoingPrescriptionNeed,
         FormId = resident.FormId,
         FormVersion = resident.FormVersion,
         DateTimeRecorded = resident.DateTimeRecorded,
         FirstName = resident.FirstName,
         LastName = resident.LastName,
         DobMonth = resident.DobMonth,
         DobYear = resident.DobYear,
         DobDay = resident.DobDay,
         Postcode = resident.Postcode,
         Uprn = resident.Uprn,
         Ward = resident.Ward,
         AddressFirstLine = resident.AddressFirstLine,
         AddressSecondLine = resident.AddressSecondLine,
         AddressThirdLine = resident.AddressThirdLine,
         ContactTelephoneNumber = resident.ContactTelephoneNumber,
         ContactMobileNumber = resident.ContactMobileNumber,
         EmailAddress = resident.EmailAddress,
         IsOnBehalf = resident.IsOnBehalf,
         OnBehalfFirstName = resident.OnBehalfFirstName,
         OnBehalfLastName = resident.OnBehalfLastName,
         OnBehalfEmailAddress = resident.OnBehalfEmailAddress,
         OnBehalfContactNumber = resident.OnBehalfContactNumber,
         RelationshipWithResident = resident.RelationshipWithResident,
         AnythingElse = resident.AnythingElse,
         GpSurgeryDetails = resident.GpSurgeryDetails,
         FoodNeed = resident.FoodNeed,
         NumberOfPeopleInHouse = resident.NumberOfPeopleInHouse,
         DaysWorthOfFood = resident.DaysWorthOfFood,
         AnyFoodHouseholdCannotEat = resident.AnyFoodHouseholdCannotEat,
         StrugglingToPayForFood = resident.StrugglingToPayForFood,
         IsPharmacistAbleToDeliver = resident.IsPharmacistAbleToDeliver,
         NameAddressPharmacist = resident.NameAddressPharmacist,
         IsPackageOfCareAsc = resident.IsPackageOfCareAsc,
         IsUrgentFoodRequired = resident.IsUrgentFoodRequired,
         DaysWorthOfMedicine = resident.DaysWorthOfMedicine,
         IsUrgentMedicineRequired = resident.IsUrgentMedicineRequired,
         IsAddressConfirmed = resident.IsAddressConfirmed,
         IsHouseholdHelpAvailable = resident.IsHouseholdHelpAvailable,
         IsUrgentFood = resident.IsUrgentFood,
         IsUrgentPrescription = resident.IsUrgentPrescription,
         AnyHelpAvailable = resident.AnyHelpAvailable,
         IsAnyAgedUnder15 = resident.IsAnyAgedUnder15,
         LastConfirmedFoodDelivery = resident.LastConfirmedFoodDelivery,
         RecordStatus = resident.RecordStatus,
         DeliveryNotes = resident.DeliveryNotes,
         CaseNotes = resident.CaseNotes,
     });
 }
Exemplo n.º 2
0
        public void ResidentSupportAnnexMapToV2WithMinimalInformation()
        {
            var classUnderTest = new ResidentSupportAnnex {
                Id = 1
            };

            classUnderTest.ToResponse().Should().BeEquivalentTo(new ResidentSupportAnnexResponse
            {
                Id = 1
            });
        }
Exemplo n.º 3
0
        private static void AssertAllFieldsHaveCorrectlyMapped(ResidentSupportAnnexResponse mappedResponse,
                                                               ResidentSupportAnnex classUnderTest)
        {
            mappedResponse.Id.Should().Be(classUnderTest.Id);
            mappedResponse.IsDuplicate.Should().Be(classUnderTest.IsDuplicate);
            mappedResponse.OngoingFoodNeed.Should().Be(classUnderTest.OngoingFoodNeed);
            mappedResponse.OngoingPrescriptionNeed.Should().Be(classUnderTest.OngoingPrescriptionNeed);
            mappedResponse.FormId.Should().Be(int.Parse(classUnderTest.FormId));
            mappedResponse.FormVersion.Should().Be(classUnderTest.FormVersion);
            mappedResponse.DateTimeRecorded.Should().Be($"{classUnderTest.DateTimeRecorded.Value.Year:0000}-{classUnderTest.DateTimeRecorded.Value.Month:00}-{classUnderTest.DateTimeRecorded.Value.Day:00}");
            mappedResponse.FirstName.Should().Be(classUnderTest.FirstName);
            mappedResponse.LastName.Should().Be(classUnderTest.LastName);
            mappedResponse.DateOfBirth.Should().Be("1960-11-13");
            mappedResponse.Postcode.Should().Be(classUnderTest.Postcode);
            mappedResponse.Uprn.Should().Be(classUnderTest.Uprn);
            mappedResponse.Ward.Should().Be(classUnderTest.Ward);
            mappedResponse.AddressFirstLine.Should().Be(classUnderTest.AddressFirstLine);
            mappedResponse.AddressSecondLine.Should().Be(classUnderTest.AddressSecondLine);
            mappedResponse.AddressThirdLine.Should().Be(classUnderTest.AddressThirdLine);
            mappedResponse.ContactTelephoneNumber.Should().Be(classUnderTest.ContactTelephoneNumber);
            mappedResponse.ContactMobileNumber.Should().Be(classUnderTest.ContactMobileNumber);
            mappedResponse.EmailAddress.Should().Be(classUnderTest.EmailAddress);
            mappedResponse.IsOnBehalf.Should().Be(classUnderTest.IsOnBehalf);
            mappedResponse.OnBehalfFirstName.Should().Be(classUnderTest.OnBehalfFirstName);
            mappedResponse.OnBehalfLastName.Should().Be(classUnderTest.OnBehalfLastName);
            mappedResponse.OnBehalfEmailAddress.Should().Be(classUnderTest.OnBehalfEmailAddress);
            mappedResponse.OnBehalfContactNumber.Should().Be(classUnderTest.OnBehalfContactNumber);
            mappedResponse.RelationshipWithResident.Should().Be(classUnderTest.RelationshipWithResident);
            mappedResponse.AnythingElse.Should().Be(classUnderTest.AnythingElse);
            mappedResponse.GpSurgeryDetails.Should().Be(classUnderTest.GpSurgeryDetails);
            mappedResponse.FoodNeed.Should().Be(classUnderTest.FoodNeed);
            mappedResponse.NumberOfPeopleInHouse.Should().Be(int.Parse(classUnderTest.NumberOfPeopleInHouse));
            mappedResponse.DaysWorthOfFood.Should().Be(int.Parse(classUnderTest.DaysWorthOfFood));
            mappedResponse.AnyFoodHouseholdCannotEat.Should().Be(classUnderTest.AnyFoodHouseholdCannotEat);
            mappedResponse.StrugglingToPayForFood.Should().Be(classUnderTest.StrugglingToPayForFood);
            mappedResponse.IsPharmacistAbleToDeliver.Should().Be(classUnderTest.IsPharmacistAbleToDeliver);
            mappedResponse.NameAddressPharmacist.Should().Be(classUnderTest.NameAddressPharmacist);
            mappedResponse.IsPackageOfCareAsc.Should().Be(classUnderTest.IsPackageOfCareAsc);
            mappedResponse.IsUrgentFoodRequired.Should().Be(classUnderTest.IsUrgentFoodRequired);
            mappedResponse.DaysWorthOfMedicine.Should().Be(int.Parse(classUnderTest.DaysWorthOfMedicine));
            mappedResponse.IsUrgentMedicineRequired.Should().Be(classUnderTest.IsUrgentMedicineRequired);
            mappedResponse.IsAddressConfirmed.Should().Be(classUnderTest.IsAddressConfirmed);
            mappedResponse.IsHouseholdHelpAvailable.Should().Be(classUnderTest.IsHouseholdHelpAvailable);
            mappedResponse.IsUrgentFood.Should().Be(classUnderTest.IsUrgentFood);
            mappedResponse.IsUrgentPrescription.Should().Be(classUnderTest.IsUrgentPrescription);
            mappedResponse.AnyHelpAvailable.Should().Be(classUnderTest.AnyHelpAvailable);
            mappedResponse.IsAnyAgedUnder15.Should().Be(classUnderTest.IsAnyAgedUnder15);

            mappedResponse.LastConfirmedFoodDelivery.Should().Be(classUnderTest.LastConfirmedFoodDelivery.Value.ToString("yyyy-MM-ddTHH:mm:ss"));
            mappedResponse.RecordStatus.Should().Be(classUnderTest.RecordStatus);
            mappedResponse.DeliveryNotes.Should().Be(classUnderTest.DeliveryNotes);
            mappedResponse.CaseNotes.Should().Be(classUnderTest.CaseNotes);
        }
        public void UpdateHelpRequest(ResidentSupportAnnex data)
        {
            var rec = _dbContext.ResidentSupportAnnex.Find(data.Id);

            rec.IsDuplicate             = data.IsDuplicate;
            rec.OngoingFoodNeed         = data.OngoingFoodNeed;
            rec.OngoingPrescriptionNeed = data.OngoingPrescriptionNeed;
            rec.FirstName                 = data.FirstName;
            rec.LastName                  = data.LastName;
            rec.DobMonth                  = data.DobMonth;
            rec.DobYear                   = data.DobYear;
            rec.DobDay                    = data.DobDay;
            rec.Postcode                  = data.Postcode;
            rec.Uprn                      = data.Uprn;
            rec.Ward                      = data.Ward;
            rec.AddressFirstLine          = data.AddressFirstLine;
            rec.AddressSecondLine         = data.AddressSecondLine;
            rec.AddressThirdLine          = data.AddressThirdLine;
            rec.ContactTelephoneNumber    = data.ContactTelephoneNumber;
            rec.ContactMobileNumber       = data.ContactMobileNumber;
            rec.EmailAddress              = data.EmailAddress;
            rec.IsOnBehalf                = data.IsOnBehalf;
            rec.OnBehalfFirstName         = data.OnBehalfFirstName;
            rec.OnBehalfLastName          = data.OnBehalfLastName;
            rec.OnBehalfEmailAddress      = data.OnBehalfEmailAddress;
            rec.OnBehalfContactNumber     = data.OnBehalfContactNumber;
            rec.RelationshipWithResident  = data.RelationshipWithResident;
            rec.AnythingElse              = data.AnythingElse;
            rec.GpSurgeryDetails          = data.GpSurgeryDetails;
            rec.FoodNeed                  = data.FoodNeed;
            rec.NumberOfPeopleInHouse     = data.NumberOfPeopleInHouse;
            rec.DaysWorthOfFood           = data.DaysWorthOfFood;
            rec.AnyFoodHouseholdCannotEat = data.AnyFoodHouseholdCannotEat;
            rec.StrugglingToPayForFood    = data.StrugglingToPayForFood;
            rec.IsPharmacistAbleToDeliver = data.IsPharmacistAbleToDeliver;
            rec.NameAddressPharmacist     = data.NameAddressPharmacist;
            rec.IsPackageOfCareAsc        = data.IsPackageOfCareAsc;
            rec.IsUrgentFoodRequired      = data.IsUrgentFoodRequired;
            rec.DaysWorthOfMedicine       = data.DaysWorthOfMedicine;
            rec.IsUrgentMedicineRequired  = data.IsUrgentMedicineRequired;
            rec.IsAddressConfirmed        = data.IsAddressConfirmed;
            rec.IsHouseholdHelpAvailable  = data.IsHouseholdHelpAvailable;
            rec.IsUrgentFood              = data.IsUrgentFood;
            rec.IsUrgentPrescription      = data.IsUrgentPrescription;
            rec.AnyHelpAvailable          = data.AnyHelpAvailable;
            rec.IsAnyAgedUnder15          = data.IsAnyAgedUnder15;
            rec.LastConfirmedFoodDelivery = data.LastConfirmedFoodDelivery;
            rec.RecordStatus              = data.RecordStatus;
            rec.DeliveryNotes             = data.DeliveryNotes;
            rec.CaseNotes                 = data.CaseNotes;
            _dbContext.SaveChanges();
        }
        public void WithNoMatchingHelpRequest_ReturnsNotFound()
        {
            var helpRequest = new ResidentSupportAnnex {
                Id = 1
            };

            DbContext.ResidentSupportAnnex.Add(helpRequest);
            DbContext.SaveChanges();

            var response = _handler.GetHelpRequest(new APIGatewayProxyRequest
            {
                PathParameters = new Dictionary <string, string> {
                    { "id", "2" }
                }
            }, null);

            response.StatusCode.Should().Be(404);
        }
Exemplo n.º 6
0
        public void ReturnsCamelCasedResponse()
        {
            var helpRequest = new ResidentSupportAnnex
            {
                Id = 1,
            };

            DbContext.ResidentSupportAnnex.Add(helpRequest);
            DbContext.SaveChanges();
            var response = _handler.GetHelpRequests(new APIGatewayProxyRequest(), null);

            response.StatusCode.Should().Be(200);
            response.Body.Should().BeEquivalentTo(@"{
  ""helpRequests"": [
    {
      ""id"": 1,
      ""isDuplicate"": ""FALSE"",
      ""recordStatus"": ""MASTER""
    }
  ]
}");
        }
        public void ReturnsCamelCasedResponse()
        {
            var helpRequest = new ResidentSupportAnnex {
                Id = 1
            };

            DbContext.ResidentSupportAnnex.Add(helpRequest);
            DbContext.SaveChanges();

            var response = _handler.GetHelpRequest(new APIGatewayProxyRequest
            {
                PathParameters = new Dictionary <string, string> {
                    { "id", "1" }
                }
            }, null);

            response.StatusCode.Should().Be(200);
            response.Body.Should().BeEquivalentTo(@"{
  ""id"": 1,
  ""isDuplicate"": ""FALSE"",
  ""recordStatus"": ""MASTER""
}");
        }
 private void InsertIntoResidentSupportAnnexTable(ResidentSupportAnnex request)
 {
     _context.ResidentSupportAnnex.Add(request);
     _context.SaveChanges();
 }
 public void UpdateHelpRequest(int id, ResidentSupportAnnex data)
 {
     data.Id = id;
     _iNeedHelpGateway.UpdateHelpRequest(data);
 }