コード例 #1
0
        public void ListManagedLocations()
        {
            IQueryMerchantData queryClient = ClientModuleIntegrationTestingUtilities.GetSandboxedLevelUpModule <IQueryMerchantData>();
            var locations = queryClient.ListManagedLocations(ClientModuleIntegrationTestingUtilities.SandboxedLevelUpMerchantAccessToken);

            Assert.IsTrue(locations.Count > 0);
            Assert.AreEqual(locations.Count(x => x.LocationId == LevelUpTestConfiguration.Current.MerchantLocationId), 1);
        }
コード例 #2
0
        public void ListManagedLocationsShouldSucceed()
        {
            string expectedRequestUrl = ClientModuleFunctionalTestingUtilities.SANDBOX_URL_PREFIX + "/v15/managed_locations";

            RestResponse expectedResponse = new RestResponse
            {
                StatusCode = HttpStatusCode.OK,
                Content    =
                    "[{" +
                    "\"location\": {" +
                    "\"address\": \"101 Arch St., Boston, MA\"," +
                    "\"id\": 3," +
                    "\"merchant_id\": 1," +
                    "\"merchant_name\": \"LevelUp Cafe\"," +
                    "\"name\": \"LU#3 - 101 Arch St.\"," +
                    "\"tip_preference\": \"expected\"" +
                    "}" +
                    "}," +
                    "{" +
                    "\"location\": {" +
                    "\"address\": \"1 Beach Dr, Honolulu, HI\"," +
                    "\"id\": 10," +
                    "\"merchant_id\": 1001," +
                    "\"merchant_name\": \"Hang Ten Cafe\"," +
                    "\"name\": \"LU#10 - 1 Beach Dr.\"," +
                    "\"tip_preference\": \"unwanted\"" +
                    "}" +
                    "}]"
            };

            string expectedAccessToken = "token merchant=\"my_access_token\"";

            IQueryMerchantData client = ClientModuleFunctionalTestingUtilities.GetMockedLevelUpModule <IQueryMerchantData>(
                expectedResponse, expectedRequestUrl: expectedRequestUrl, expectedAccessToken: expectedAccessToken);
            var locations = client.ListManagedLocations("my_access_token");

            Assert.IsTrue(locations.Count == 2);
            Assert.IsTrue(locations[0].LocationId == 3);
            Assert.IsTrue(locations[0].TipPreference == "expected");
        }