public void Get_Hotels_List_Sort_By_Price_ASC_Pass() { List <String> desiredResp = new List <String> { Constants.CONST_HOTEL_CONCORDE, Constants.CONST_HOTEL_ROTANA, Constants.CONST_HOTEL_LE_MERIDIEN, Constants.CONST_HOTEL_MEDIA_ONE, Constants.CONST_HOTEL_GOLDEN_TULIP, Constants.CONST_HOTEL_NOVOTEL }; //Act ResponseHotel resp = hotelSearchService.SearchResultJson_Get(null, null, null, null, null, null, null, "ASC"); List <String> hotelNames = new List <string>(); foreach (Hotel h in resp.Hotels) { hotelNames.Add(h.Name); } //Assert CollectionAssert.AreEqual(desiredResp, hotelNames, Constants.CONST_CHECK_ALL_HOTELS_ORDER_BY_PRICE_ASC_RESULT); }
public void Get_Hotels_To_Date_Sort_By_Price_DESC_Pass() { List <String> desiredResp = new List <String> { Constants.CONST_HOTEL_NOVOTEL, Constants.CONST_HOTEL_MEDIA_ONE, Constants.CONST_HOTEL_LE_MERIDIEN, Constants.CONST_HOTEL_ROTANA, Constants.CONST_HOTEL_CONCORDE }; //Act ResponseHotel resp = hotelSearchService.SearchResultJson_Get(null, null, null, null, "", "10-12-2020", null, "desc"); List <String> hotelNames = new List <string>(); foreach (Hotel h in resp.Hotels) { hotelNames.Add(h.Name); } //Assert CollectionAssert.AreEqual(desiredResp, hotelNames, Constants.CONST_CHECK_HOTEL_BY_TO_DATE_ORDER_BY_NAME_PRICE_DESC_RESULT); iHotelSearchService.VerifyAllExpectations(); }
/// <summary> /// This method wil return JSON and in case further operations are desired on result set it can be perfomrmed in this method before returning result /// </summary> /// <param name="requestHotel"></param> /// <returns></returns> public ResponseHotel SearchResultXML(RequestHotel requestHotel) { // in case in future further operations need to be performed on XML data // Result should be sent with proper details in case of failures either error or validations ResponseHotel responseSearch = new ResponseHotel(); try { // in case in future further operations need to be performed on XML data responseSearch.Hotels = Search(requestHotel); // if all operations are perfomred well return success code responseSearch.Code = Constants.CONST_RESULT_CODE_SUCCESS; } catch (CustomException ex) { responseSearch.Messages = ex.Messages; // General failure code to inform client that request went unsuccessful responseSearch.Code = Constants.CONST_RESULT_CODE_FAILURE; } catch { responseSearch.Messages = new List <CustomMessage> { new CustomMessage { Code = Constants.CONST_EXCEPTION_INTERNAL_ERROR, Message = Constants.CONST_EXCEPTION_INTERNAL_ERROR_DESCRIPTION } }; // General failure code to inform client that request went unsuccessful responseSearch.Code = Constants.CONST_RESULT_CODE_FAILURE; } return(responseSearch); }
public void Get_Hotels_Return_NotNull_Pass() { var resp = new ResponseHotel(); //Set Up iHotelSearchService.Stub(dt => dt.SearchResultJson_Get(null, null, null, null, null, null, null, null)).IgnoreArguments().Return(resp); //Assert Assert.IsNotNull(resp, Constants.CONST_CHECK_RESPONSE_NOT_NULL_RESULT); }
/// <summary> /// /// </summary> /// <param name="hotelName"></param> /// <param name="destination"></param> /// <param name="rangeFrom"></param> /// <param name="rangeTo"></param> /// <param name="dateFrom"></param> /// <param name="dateTo"></param> /// <param name="sortByName"></param> /// <param name="sortByPrice"></param> /// <returns></returns> public ResponseHotel SearchResultXML_Get(String hotelName, String destination, String rangeFrom, String rangeTo, String dateFrom, String dateTo, String sortByName, String sortByPrice) { // in case in future further operations need to be performed on XML data // Result should be sent with proper details in case of failures either error or validations ResponseHotel responseSearch = new ResponseHotel(); HotelBAL hotelBAL = new HotelBAL(); try { // first check that vaid values are sent in paramater for get request if (hotelBAL.AreParameterTypesValidForSearch(rangeFrom, rangeTo, dateFrom, dateTo)) { RequestHotel requestHotel = TransformGetValuestoRequestModel(hotelName, destination, rangeFrom, rangeTo, dateFrom, dateTo, sortByName, sortByPrice); // in case in future further operations need to be performed on XML data responseSearch.Hotels = Search(requestHotel); // if all operations are perfomred well return success code responseSearch.Code = Constants.CONST_RESULT_CODE_SUCCESS; } } catch (CustomException ex) { responseSearch.Messages = ex.Messages; // General failure code to inform client that request went unsuccessful responseSearch.Code = Constants.CONST_RESULT_CODE_FAILURE; } catch { responseSearch.Messages = new List <CustomMessage> { new CustomMessage { Code = Constants.CONST_EXCEPTION_INTERNAL_ERROR, Message = Constants.CONST_EXCEPTION_INTERNAL_ERROR_DESCRIPTION } }; // General failure code to inform client that request went unsuccessful responseSearch.Code = Constants.CONST_RESULT_CODE_FAILURE; } return(responseSearch); }
public void Get_Hotels_By_Destination_Pass() { List <String> desiredResp = new List <String> { Constants.CONST_HOTEL_CONCORDE }; //Act ResponseHotel resp = hotelSearchService.SearchResultJson_Get(null, "MANILA", null, null, null, null, null, null); List <String> hotelNames = new List <string>(); foreach (Hotel h in resp.Hotels) { hotelNames.Add(h.Name); } //Assert CollectionAssert.AreEqual(desiredResp, hotelNames, Constants.CONST_CHECK_HOTEL_BY_DESINATION_RESULT); }
public void Get_Hotels_By_Date_Range_Sort_By_Name_ASC_Sort_By_Price_DESC_Pass() { List <String> desiredResp = new List <String> { Constants.CONST_HOTEL_CONCORDE, Constants.CONST_HOTEL_NOVOTEL }; //Act ResponseHotel resp = hotelSearchService.SearchResultJson_Get(null, null, null, null, "05-11-2020", "16-11-2020", "asc", "DESC"); List <String> hotelNames = new List <string>(); foreach (Hotel h in resp.Hotels) { hotelNames.Add(h.Name); } //Assert CollectionAssert.AreEqual(desiredResp, hotelNames, Constants.CONST_CHECK_HOTEL_BY_DATE_RANGE_ORDER_BY_NAME_ASC_ORDER_BY_PRICE_DESC_RESULT); }
public void Get_Hotels_By_Price_Range_Sort_By_Price_Desc_Pass() { List <String> desiredResp = new List <String> { Constants.CONST_HOTEL_LE_MERIDIEN, Constants.CONST_HOTEL_ROTANA }; //Act ResponseHotel resp = hotelSearchService.SearchResultJson_Get(null, "", "80", "100", null, null, null, "DESC"); List <String> hotelNames = new List <string>(); foreach (Hotel h in resp.Hotels) { hotelNames.Add(h.Name); } //Assert CollectionAssert.AreEqual(desiredResp, hotelNames, Constants.CONST_CHECK_HOTEL_BY_PRICE_RANGE_ORDER_BY_PRICE_DESC_RESULT); }
public void Get_Hotels_From_Price_Sort_By_Name_ASC_Pass() { List <String> desiredResp = new List <String> { Constants.CONST_HOTEL_GOLDEN_TULIP, Constants.CONST_HOTEL_MEDIA_ONE, Constants.CONST_HOTEL_NOVOTEL }; //Act ResponseHotel resp = hotelSearchService.SearchResultJson_Get(null, "", "90", "", null, null, "ASC", null); List <String> hotelNames = new List <string>(); foreach (Hotel h in resp.Hotels) { hotelNames.Add(h.Name); } //Assert CollectionAssert.AreEqual(desiredResp, hotelNames, Constants.CONST_CHECK_HOTEL_PRICE_FROM_ORDER_BY_NAME_ASC_RESULT); }
public void Get_Hotels_By_Name_Sort_By_Name_Desc_Pass() { List <String> desiredResp = new List <String> { Constants.CONST_HOTEL_ROTANA, Constants.CONST_HOTEL_NOVOTEL, Constants.CONST_HOTEL_MEDIA_ONE, Constants.CONST_HOTEL_CONCORDE }; //Act ResponseHotel resp = hotelSearchService.SearchResultJson_Get("Hotel", null, null, null, null, null, "desc", null); List <String> hotelNames = new List <string>(); foreach (Hotel h in resp.Hotels) { hotelNames.Add(h.Name); } //Assert CollectionAssert.AreEqual(desiredResp, hotelNames, Constants.CONST_CHECK_ALL_HOTELS_ORDER_BY_NAME_DESC_RESULT); }