Exemplo n.º 1
0
        public void CanConsumeJSONAPI()
        {
            //Arrange
            JObject Offers = null;

            //Act
            Offers = HotelDeals.GetJSON();

            //Assert
            Assert.AreNotEqual(Offers, null);
        }
Exemplo n.º 2
0
        public void canGetDistinantions()
        {
            //Arrange
            JArray Destinations = null;

            //Act
            Destinations = (JArray)HotelDeals.GetJSON()["offers"]["Hotel"];
            foreach (var item in Destinations)
            {
                string js = JsonConvert.SerializeObject(item.SelectToken("destination"));
                DestinationCollection.addDestination(JsonConvert.DeserializeObject <Destination>(js));
            }

            //Assert
            Assert.AreNotEqual(DestinationCollection.GetDestinantions().Count, 0);
        }
Exemplo n.º 3
0
        private void fillDestinantionDll()
        {
            DestinationCollection.GetDestinantions().Clear();
            // get list of hotels in JSON object
            var Hotels = (JArray)HotelDeals.GetJSON()["offers"]["Hotel"];

            //itrate each hotel to get destination and put it in list
            foreach (var item in Hotels)
            {
                string js = JsonConvert.SerializeObject(item.SelectToken("destination"));
                DestinationCollection.addDestination(JsonConvert.DeserializeObject <Destination>(js));
            }
            ddlDestination.DataSource     = DestinationCollection.GetDestinantions();
            ddlDestination.DataValueField = "regionID";
            ddlDestination.DataTextField  = "city";
            ddlDestination.DataBind();
        }