Exemple #1
0
        public void ListLocations()
        {
            IQueryMerchantData queryClient = ClientModuleIntegrationTestingUtilities.GetSandboxedLevelUpModule <IQueryMerchantData>();
            var locations = queryClient.ListLocations(ClientModuleIntegrationTestingUtilities.SandboxedLevelUpMerchantAccessToken,
                                                      LevelUpTestConfiguration.Current.MerchantId);

            Assert.IsTrue(locations.Count > 0);
            Assert.AreEqual(locations.Count(x => x.LocationId == LevelUpTestConfiguration.Current.MerchantLocationId), 1);
        }
Exemple #2
0
        public void ListLocationsShouldSucceed()
        {
            const int merchantId         = 34;
            string    expectedRequestUrl = string.Format(ClientModuleFunctionalTestingUtilities.SANDBOX_URL_PREFIX + "/v15/merchants/{0}/locations", merchantId);

            RestResponse expectedResponse = new RestResponse
            {
                StatusCode = HttpStatusCode.OK,
                Content    =
                    "[{" +
                    "\"location\": {" +
                    "\"extended_address\": \"\"," +
                    "\"facebook_url\": null," +
                    "\"foodler_url\": null," +
                    "\"hours\": \"\"," +
                    "\"id\": 19," +
                    "\"latitude\": 42.351231," +
                    "\"locality\": \"Boston\"," +
                    "\"longitude\": -71.077396," +
                    "\"menu_url\": null," +
                    "\"merchant_id\": 34," +
                    "\"merchant_description_html\": \"SampleMerchant\"," +
                    "\"merchant_name\": \"SampleMerchant\"," +
                    "\"merchant_tip_preference\": \"no preference\"," +
                    "\"name\": null," +
                    "\"newsletter_url\": null," +
                    "\"opentable_url\": null," +
                    "\"phone\": \"\"," +
                    "\"postal_code\": \"02114\"," +
                    "\"region\": \"Massachusetts\"," +
                    "\"street_address\": \"1234 Test Street\"," +
                    "\"twitter_url\": null," +
                    "\"updated_at\": \"2015-01-22T14:26:19-05:00\"," +
                    "\"yelp_url\": null," +
                    "\"shown\": true" +
                    "}" +
                    "}," +
                    "{" +
                    "\"location\": {" +
                    "\"extended_address\": \"\"," +
                    "\"facebook_url\": null," +
                    "\"foodler_url\": null," +
                    "\"hours\": \"\"," +
                    "\"id\": 19," +
                    "\"latitude\": 42.351231," +
                    "\"locality\": \"Boston\"," +
                    "\"longitude\": -71.077396," +
                    "\"menu_url\": null," +
                    "\"merchant_id\": 34," +
                    "\"merchant_description_html\": \"SampleMerchant\"," +
                    "\"merchant_name\": \"SampleMerchant\"," +
                    "\"merchant_tip_preference\": \"no preference\"," +
                    "\"name\": null," +
                    "\"newsletter_url\": null," +
                    "\"opentable_url\": null," +
                    "\"phone\": \"\"," +
                    "\"postal_code\": \"02114\"," +
                    "\"region\": \"Massachusetts\"," +
                    "\"street_address\": \"1234 Test Street\"," +
                    "\"twitter_url\": null," +
                    "\"updated_at\": \"2015-01-22T14:26:19-05:00\"," +
                    "\"yelp_url\": null," +
                    "\"shown\": true" +
                    "}" +
                    "}]"
            };

            IQueryMerchantData client = ClientModuleFunctionalTestingUtilities.GetMockedLevelUpModule <IQueryMerchantData>(
                expectedResponse, expectedRequestUrl: expectedRequestUrl);
            var locations = client.ListLocations("not_checking_this", merchantId);

            Assert.IsTrue(locations.Count == 2);
            Assert.IsTrue(locations[0].Name == null);
            Assert.IsTrue(locations[0].TipPreference == "no preference");
            Assert.IsTrue(locations[0].LocationId == 19);
        }