Exemplo n.º 1
0
        public async Task <IActionResult> RequestUpdateHousehold([FromBody] HouseholdUpdateRequest household)
        {
            string userId = household.ModifiedBy;

            return(await RequestHandler <HouseholdResponse>(HttpVerbs.Put, userId, async() =>
                                                            await householdsRepository.UpdateHousehold(household)));
        }
Exemplo n.º 2
0
 public async Task <HouseholdResponse> UpdateHousehold(HouseholdUpdateRequest household)
 {
     return(await asyncConnection(household.ModifiedBy, household.OccupantId, async db =>
     {
         HouseholdResponse rowsUpdated = await db.QueryFirstOrDefaultAsync <HouseholdResponse>(
             sql: "[Houses].[Households_Update]",
             param: household,
             commandType: CommandType.StoredProcedure
             );
         return rowsUpdated;
     }));
 }
Exemplo n.º 3
0
        public void InvalidOccupantIdTest()
        {
            HouseholdUpdateRequest householdToUpdate = new HouseholdUpdateRequest
            {
                OccupantId = 9,
                Name       = StringGenerator.RandomString(50),
                ModifiedBy = firebaseFixture.H1UserId
            };
            RestClient    client   = GetClient();
            RestRequest   request  = apiCall <HouseholdUpdateRequest>(firebaseFixture.H1Token, sutEndpoint, sutHttpMethod, householdToUpdate);
            IRestResponse response = client.Execute(request);

            forbiddenExpectations(response);
        }
Exemplo n.º 4
0
        public void UpdateHouseholdTest()
        {
            string H5HouseholdName = StringGenerator.RandomString(50);
            HouseholdUpdateRequest householdToUpdate = new HouseholdUpdateRequest
            {
                OccupantId = 9,
                Name       = H5HouseholdName,
                ModifiedBy = firebaseFixture.H2UserId
            };

            RestClient  client  = GetClient();
            RestRequest request = apiCall <HouseholdUpdateRequest>(firebaseFixture.H2Token, sutEndpoint, sutHttpMethod, householdToUpdate);
            IRestResponse <HouseholdResponse> response = client.Execute <HouseholdResponse>(request);

            string expectedContent = serialize(new HouseholdResponse
            {
                OccupantId = 9,
                Name       = H5HouseholdName,
            });

            response.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.OK);
            response.Content.ShouldBeEquivalentTo(expectedContent);
        }