Example #1
0
        public void TestJustEatClient()
        {
            Services.JustEatClient jeClient       = new Services.JustEatClient();
            List <Restaurant>      restaurantList = jeClient.GetAvailableRestaurants("SE19").GetAwaiter().GetResult();

            // Just test we reached here without an exception
            Assert.Equal(true, true);

            restaurantList = jeClient.GetAvailableRestaurants("").GetAwaiter().GetResult();
            // Just test we reached here without an exception
            Assert.Equal(true, true);
        }
Example #2
0
        public void TestJustEatClient()
        {
            var responseMessage = new HttpResponseMessage();

            responseMessage.Content = new FakeHttpContent(JustEatData.twoRestaurants);

            var messageHandler = new FakeHttpMessageHandler(responseMessage);
            var client         = new HttpClient(messageHandler);

            Services.JustEatClient jeClient       = new Services.JustEatClient(client);
            List <Restaurant>      restaurantList = jeClient.GetAvailableRestaurants("SE19").GetAwaiter().GetResult();

            // Two restaurants supplied but only one is open
            Assert.Equal(1, restaurantList.Count);

            // Get the single restaurant
            Restaurant restaurant = restaurantList[0];

            // Check the properties are set correctly
            Assert.Equal("Golden Fish", restaurant.Name);
            Assert.Equal("4.7", restaurant.Rating);
            string[] expectedCuisine = new string[] { "Chinese", "Thai" };
            Assert.Equal(expectedCuisine, restaurant.CuisineTypes);
        }