Ejemplo n.º 1
0
            public IEnumerator CreateOrder_FictionalItem_Error()
            {
                Orders             orders = AccelBytePlugin.GetOrders();
                OrderRequest       orderRequest;
                Result <OrderInfo> createOrderResult = null;

                orderRequest = new OrderRequest
                {
                    currencyCode    = "JPY",
                    discountedPrice = 5,
                    itemId          = "abcde12345",
                    price           = 5,
                    quantity        = 1,
                    returnUrl       = "https://www.example.com"
                };
                orders.CreateOrder(orderRequest, result => { createOrderResult = result; });

                while (createOrderResult == null)
                {
                    Thread.Sleep(100);

                    yield return(null);
                }

                TestHelper.Assert.IsTrue(createOrderResult.IsError, "Create an order with a non-existing item failed.");
            }
Ejemplo n.º 2
0
            public IEnumerator GetUserOrder_OrderExists_Success()
            {
                Items        items        = AccelBytePlugin.GetItems();
                ItemCriteria itemCriteria = new ItemCriteria
                {
                    categoryPath = TestVariables.expectedChildCategoryPath,
                    sortBy       = "createdAt:desc"
                };
                Result <ItemPagingSlicedResult> getItemsByCriteria = null;

                items.GetItemsByCriteria(
                    itemCriteria,
                    result =>
                {
                    getItemsByCriteria = result;
                });

                while (getItemsByCriteria == null)
                {
                    Thread.Sleep(100);

                    yield return(null);
                }

                int          quantity     = 1;
                Orders       orders       = AccelBytePlugin.GetOrders();
                OrderRequest orderRequest = new OrderRequest
                {
                    currencyCode    = getItemsByCriteria.Value.data[0].regionData[0].currencyCode,
                    discountedPrice = getItemsByCriteria.Value.data[0].regionData[0].discountedPrice * quantity,
                    itemId          = getItemsByCriteria.Value.data[0].itemId,
                    price           = getItemsByCriteria.Value.data[0].regionData[0].price * quantity,
                    quantity        = quantity,
                    returnUrl       = "https://www.example.com"
                };
                Result <OrderInfo> createOrderResult = null;

                orders.CreateOrder(orderRequest, result => { createOrderResult = result; });

                while (createOrderResult == null)
                {
                    Thread.Sleep(100);

                    yield return(null);
                }

                Result <OrderInfo> getUserOrderResult = null;

                orders.GetUserOrder(createOrderResult.Value.orderNo, result => { getUserOrderResult = result; });

                while (getUserOrderResult == null)
                {
                    Thread.Sleep(100);

                    yield return(null);
                }

                TestHelper.Assert.IsTrue(!getUserOrderResult.IsError, "Get user order failed.");
            }
Ejemplo n.º 3
0
            public IEnumerator GetUserOrders_UserHasOrderHistory_Success()
            {
                Orders orders = AccelBytePlugin.GetOrders();
                Result <OrderPagingSlicedResult> getUserOrdersResult = null;

                orders.GetUserOrders(0, 3, result => { getUserOrdersResult = result; });

                while (getUserOrdersResult == null)
                {
                    Thread.Sleep(100);

                    yield return(null);
                }

                TestHelper.Assert.IsTrue(!getUserOrdersResult.IsError, "Get user orders failed.");
            }
Ejemplo n.º 4
0
            public IEnumerator GetUserOrderHistory_OrderNumberDoesNotExist_Success()
            {
                Orders       orders = AccelBytePlugin.GetOrders();
                const string orderNumberDoesNotExist = "1555";
                Result <OrderHistoryInfo[]> getUserOrderHistoryResult = null;

                orders.GetUserOrderHistory(orderNumberDoesNotExist, result => { getUserOrderHistoryResult = result; });

                while (getUserOrderHistoryResult == null)
                {
                    Thread.Sleep(100);

                    yield return(null);
                }

                TestHelper.Assert.IsTrue(!getUserOrderHistoryResult.IsError, "Get user order history failed.");
            }
Ejemplo n.º 5
0
            public IEnumerator GetUserOrder_OrderDoesNotExist_Failed()
            {
                Orders             orders = AccelBytePlugin.GetOrders();
                const string       orderNumberDoesNotExist = "15550000";
                Result <OrderInfo> getUserOrderResult      = null;

                orders.GetUserOrder(orderNumberDoesNotExist, result => { getUserOrderResult = result; });

                while (getUserOrderResult == null)
                {
                    Thread.Sleep(100);

                    yield return(null);
                }

                TestHelper.Assert.IsTrue(getUserOrderResult.IsError, "Get user's invalid order does not failed.");
            }