public void should_traverse_through_collections_without_index()
        {
            object orders = TestHelper.GetNorthwindOrders();

            object order_details = ObjectGraphPathTraverser.TraversePath(orders, "Order_Details");

            Assert.IsTrue(order_details is IEnumerable <Order_Detail>);
        }
        public void should_traverse_through_collections_with_index()
        {
            object orders = TestHelper.GetNorthwindOrders();

            object order_detail = ObjectGraphPathTraverser.TraversePath(orders, "[0].Order_Details[0]");

            Assert.IsTrue(order_detail is Order_Detail);
        }
        public void should_extract_item_from_collection()
        {
            object orders = TestHelper.GetNorthwindOrders();

            object order = ObjectGraphPathTraverser.TraversePath(orders, "[0]");

            Assert.IsTrue(order is NorthwindOData.Northwind.Order);
            Assert.IsNotNull(order);
        }
        public void should_traverse_up_to_collections()
        {
            object orders = TestHelper.GetNorthwindOrders();

            object order_details = ObjectGraphPathTraverser.TraversePath(orders, "[0].Order_Details");

            var collection = (order_details as IEnumerable).Cast <Order_Detail>();

            Assert.IsNotNull(collection);
        }
        public void should_allow_root_collection()
        {
            object orders = TestHelper.GetNorthwindOrders();

            // Null
            object orders2 = ObjectGraphPathTraverser.TraversePath(orders, null);

            Assert.ReferenceEquals(orders, orders2);

            // Empty String
            object orders3 = ObjectGraphPathTraverser.TraversePath(orders, "");

            Assert.ReferenceEquals(orders, orders3);
        }