Exemplo n.º 1
0
        public void Invalid_remove_relation_field_path()
        {
            var aw   = new AdventureWorks();
            var path = new FieldPath(
                aw.SalesOrderDetails["ProductID"],
                aw.Products["ProductCategoryID"],
                aw.ProductCategory.DefaultField);

            // removing the middle relation creates an invalid link between sales order.product -> category.name
            Assert.Throws <ArgumentException>(() => { path.Remove(aw.Products["ProductCategoryID"]); });
        }
Exemplo n.º 2
0
        public void Remove_field_path()
        {
            var aw   = new AdventureWorks();
            var path = new FieldPath(
                aw.SalesOrderDetails["ProductID"],
                aw.Products["ProductCategoryID"],
                aw.ProductCategory.DefaultField);

            path.Remove(aw.ProductCategory.DefaultField);
            Assert.AreEqual(2, path.Count);
            Assert.AreEqual(aw.SalesOrderDetails["ProductID"], path[0]);
            Assert.AreEqual(aw.Products["ProductCategoryID"], path[1]);
        }