Ejemplo n.º 1
0
        public void GetDataParsesMultipleProducts()
        {
            string document = GetResourceAsString("MultipleProducts.xml");
            var    result   = ODataHelper.GetData(document);

            Assert.Equal(20, result.Count());
            Assert.Equal(productProperties, result.First().Count);
        }
Ejemplo n.º 2
0
        public void GetDataParsesMultipleProductsWithCategory()
        {
            string document = GetResourceAsString("MultipleProductsWithCategory.xml");
            var    result   = ODataHelper.GetData(document);

            Assert.Equal(20, result.Count());
            Assert.Equal(productProperties + 1, result.First().Count);
            Assert.Equal(categoryProperties, (result.First()["Category"] as IDictionary <string, object>).Count);
        }
Ejemplo n.º 3
0
        public void GetDataParsesMultipleCategoriesWithProducts()
        {
            string document = GetResourceAsString("MultipleCategoriesWithProducts.xml");
            var    result   = ODataHelper.GetData(document);

            Assert.Equal(8, result.Count());
            Assert.Equal(categoryProperties + 1, result.First().Count);
            Assert.Equal(12, (result.First()["Products"] as IEnumerable <IDictionary <string, object> >).Count());
            Assert.Equal(productProperties, (result.First()["Products"] as IEnumerable <IDictionary <string, object> >).First().Count);
        }
Ejemplo n.º 4
0
        public void GetDataParsesSingleProductWithCollectionOfPrimitiveProperties()
        {
            string document = GetResourceAsString("SingleProductWithCollectionOfPrimitiveProperties.xml");
            var    result   = ODataHelper.GetData(document);

            Assert.Equal(1, result.Count());
            Assert.Equal(productProperties + 1, result.First().Count);
            var tags = result.First()["Tags"] as IList <dynamic>;

            Assert.Equal(2, tags.Count);
            Assert.Equal("Bakery", tags[0]);
            Assert.Equal("Food", tags[1]);
        }
Ejemplo n.º 5
0
        public void GetDataParsesSingleProductWithComplexProperty()
        {
            string document = GetResourceAsString("SingleProductWithComplexProperty.xml");
            var    result   = ODataHelper.GetData(document);

            Assert.Equal(1, result.Count());
            Assert.Equal(productProperties + 1, result.First().Count);
            var quantity = result.First()["Quantity"] as IDictionary <string, object>;

            Assert.NotNull(quantity);
            Assert.Equal(10d, quantity["Value"]);
            Assert.Equal("bags", quantity["Units"]);
        }