public void ListOrdersShouldSucceedDespiteInvalidEndPageNumbers()
        {
            IQueryOrders client = ClientModuleFunctionalTestingUtilities.GetMockedLevelUpModuleWithPaging <IQueryOrders>(successfulResponses, expectedRequestBaseUrl);

            var orders = client.ListOrders("not_checking_this", locationId, 1, 10);

            Assert.AreEqual(orders.Count, 9);

            orders = client.ListOrders("not_checking_this", locationId, 3, 11);
            Assert.AreEqual(orders.Count, 3);
        }
        public void ListOrdersShouldSucceedWhenMorePagesQueriedThanExist()
        {
            IQueryOrders client = ClientModuleFunctionalTestingUtilities.GetMockedLevelUpModuleWithPaging <IQueryOrders>(successfulResponses, expectedRequestBaseUrl);
            var          orders = client.ListOrders("not_checking_this", locationId, 1, 10); // Note that we specify pages 1-10 when only 3 pages exist

            Assert.AreEqual(orders.Count, 9);
        }
        public void ListOrdersShouldFailWith204ForInvalidStartPageNumbers()
        {
            IQueryOrders client = ClientModuleFunctionalTestingUtilities.GetMockedLevelUpModuleWithPaging <IQueryOrders>(
                successfulResponses, expectedRequestBaseUrl);
            var orders = client.ListOrders("not_checking_this", locationId, 5, 10);

            Assert.AreEqual(orders.Count, 0);
        }
        public void ListOrdersShouldSucceedAndAreThereMorePagesShouldBeValid()
        {
            IQueryOrders client = ClientModuleFunctionalTestingUtilities.GetMockedLevelUpModuleWithPaging <IQueryOrders>(successfulResponses, expectedRequestBaseUrl);
            bool         areThereMorePages;

            var orders = client.ListOrders("not_checking_this", locationId, 1, 1, out areThereMorePages);

            Assert.IsTrue(areThereMorePages);

            orders = client.ListOrders("not_checking_this", locationId, 1, 3, out areThereMorePages);
            Assert.IsFalse(areThereMorePages);

            orders = client.ListOrders("not_checking_this", locationId, 3, 3, out areThereMorePages);
            Assert.IsFalse(areThereMorePages);

            orders = client.ListOrders("not_checking_this", locationId, 2, 5, out areThereMorePages);
            Assert.IsFalse(areThereMorePages);
        }
Example #5
0
        public void ListOrders()
        {
            CompletedOrderResponse created = ClientModuleIntegrationTestingUtilities.PlaceOrderAtTestMerchantWithTestConsumer();

            IQueryOrders queryInterface = ClientModuleIntegrationTestingUtilities.GetSandboxedLevelUpModule <IQueryOrders>();
            var          orders         = queryInterface.ListOrders(ClientModuleIntegrationTestingUtilities.SandboxedLevelUpMerchantAccessToken,
                                                                    LevelUpTestConfiguration.Current.MerchantLocationId, 1, 3);

            Assert.IsNotNull(orders.Where(x => x.OrderIdentifier == created.OrderIdentifier).DefaultIfEmpty(null).FirstOrDefault());
        }
        public void ListOrdersShouldSucceedWhenAllPagesQueried()
        {
            IQueryOrders client = ClientModuleFunctionalTestingUtilities.GetMockedLevelUpModuleWithPaging <IQueryOrders>(successfulResponses, expectedRequestBaseUrl);
            var          orders = client.ListOrders("not_checking_this", locationId, 1, 3);

            Assert.AreEqual(orders.Count, 9);
            Assert.AreEqual(orders[0].OrderIdentifier, "a");
            Assert.AreEqual(orders[1].OrderIdentifier, "b");
            Assert.AreEqual(orders[2].OrderIdentifier, "c");
            Assert.AreEqual(orders[3].OrderIdentifier, "d");
            Assert.AreEqual(orders[4].OrderIdentifier, "e");
            Assert.AreEqual(orders[5].OrderIdentifier, "f");
            Assert.AreEqual(orders[6].OrderIdentifier, "g");
            Assert.AreEqual(orders[7].OrderIdentifier, "h");
            Assert.AreEqual(orders[8].OrderIdentifier, "i");
        }
Example #7
0
        private List <OrderDetailsResponse> GetFirstThreePagesOfOrdersForTestMerchant()
        {
            IQueryOrders queryInterface = ClientModuleIntegrationTestingUtilities.GetSandboxedLevelUpModule <IQueryOrders>();

            var retval = new List <OrderDetailsResponse>();

            int  currentPage       = 1;
            bool areThereMorePages = true;

            while (areThereMorePages && currentPage < 4)
            {
                var orders = queryInterface.ListOrders(ClientModuleIntegrationTestingUtilities.SandboxedLevelUpMerchantAccessToken,
                                                       LevelUpTestConfiguration.Current.MerchantLocationId, currentPage, currentPage, out areThereMorePages);
                retval.AddRange(orders);
                currentPage++;
            }
            return(retval);
        }