public async Task <BaseResult <bool> > UpdateAllocations(UpdateAllocationsRequest request) { // DynamicParameters paramCollection = RequestMapper.CreateUpdateAllocationsRequest(request); BaseResult <List <ChannelManagerRequestValidationResponse> > validationResponse = new BaseResult <List <ChannelManagerRequestValidationResponse> >(); // await iConnection.ExecuteStoredProcedure(Constants.StoredProcedure.ValidateAllocationsRequest, paramCollection).ConfigureAwait(false); return(ChannelManagerResponseMapper.MapChannelManagerRequestValidationResponse(validationResponse)); }
public static DynamicParameters CreateUpdateAllocationsRequest(UpdateAllocationsRequest request) { DynamicParameters paramCollection = new DynamicParameters(); paramCollection.Add(Constants.StoredProcedureParameters.HotelCode, request.HotelCode); paramCollection.Add(Constants.StoredProcedureParameters.ChannelManagerId, request.ChannelManagerId); // paramCollection.Add(Constants.StoredProcedureParameters.RoomTypeRatePlanList, request.RoomTypeRatePlanList); return(paramCollection); }
public async Task TestUpdateAllocations_NullRequest_RequiredFieldMissingResponse() { UpdateAllocationBaseRequest baseRequest = null; UpdateAllocationsRequest request = null; mockChannelManagerRepository.Setup(c => c.UpdateAllocations(request)).Returns(Task.FromResult(new BaseResult <bool>())); IActionResult actioResult = await mockChannelManagerController.UpdateAllocations(baseRequest); Assert.IsTrue(actioResult is BadRequestObjectResult); var result = actioResult as BadRequestObjectResult; BaseResult <bool> response = result.Value as BaseResult <bool>; Assert.AreEqual(response.ErrorCode, (int)Constants.ErrorCodes.RequiredFieldMissing); Assert.AreEqual(response.Message, string.Format(Constants.ErrorMessage.RequiredFieldMissing, "Hotel Code, Channe manger Id, Room Types and Rate Plans ")); }