コード例 #1
0
        public async Task Should_Get_Order_By_Id()
        {
            // CREATE CUSTOMER
            Customer customer = new Customer();

            customer.Name           = "Test Customer-" + Convert.ToBase64String(Guid.NewGuid().ToByteArray()).Substring(0, 8);
            customer.Groupid        = 1;
            customer.Numberoforders = 2;
            customer.Address        = new Address()
            {
                Streetname = "200 Van Exel st",
                Zipcode    = "15221-111"
            };
            customer.Billing = new BillingInfo()
            {
                CreditCardNumber = "xxx-xxxx-xxx-xxxx",
                BillinginfoId    = "x121324"
            };

            string customerId = await TestManager.CreateCustomer(customer, _factory);

            Assert.NotNull(customerId);

            Customer customerCreated = await TestManager.GetCustomer(customerId, _factory);

            OrderItem item = new OrderItem();

            item.Cost      = 120;
            item.Qty       = 10;
            item.UnitPrice = 12;
            item.ItemName  = "Talon GT";

            Order order = new Order();

            order.Customer    = customerCreated;
            order.Description = "Test Order";
            order.Shipaddress = new Address()
            {
                Streetname = "154 court street",
                Zipcode    = "15221"
            };
            order.Status     = Status.Active;
            order.OrderItems = new List <OrderItem>()
            {
                item
            };

            string orderId = await TestManager.CreateOrder(order, _factory);

            Order _order = await TestManager.GetOrder(orderId, _factory);

            Assert.Equal(orderId, _order.OrderId);
        }
コード例 #2
0
        public async Task Should_Return_For_GetOrders()
        {
            // Act

            for (int i = 0; i < 4; i++)
            {
                // CREATE ORDER
                OrderItem item = new OrderItem();
                item.Cost      = 120;
                item.Qty       = 10;
                item.UnitPrice = 12;
                item.ItemName  = "Talon GT";

                Order order = new Order();
                order.Customer = new Customer()
                {
                    Name = "Ktest-" + i
                };
                order.Description = "Test Order";
                order.Shipaddress = new Address()
                {
                    Streetname = "154 court street",
                    Zipcode    = "15221"
                };
                order.Status     = Status.Active;
                order.OrderItems = new List <OrderItem>()
                {
                    item
                };

                string orderId = await TestManager.CreateOrder(order, _factory);
            }

            List <Order> orders = await TestManager.GetOrders(_factory);

            Assert.NotNull(orders);
        }