Esempio n. 1
0
        public void ValidateDerivedContainmentNavigationWithDerivedAssociationSetCsdl()
        {
            var model          = this.GetParserResult(NavigationTestModelBuilder.DerivedContainmentNavigationWithDerivedAssociationSetCsdl());
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(model, EdmVersion.V40, expectedErrors);
        }
        public void SerializeDerivedContainmentNavigationWithDerivedAssociationSet()
        {
            var model = NavigationTestModelBuilder.DerivedContainmentNavigationWithDerivedAssociationSet();
            var csdls = NavigationTestModelBuilder.DerivedContainmentNavigationWithDerivedAssociationSetCsdl();

            this.SerializingValidator(model, csdls);
        }
        public void ParsingDerivedContainmentNavigationWithDerivedAssociationSetCsdl()
        {
            var csdls = NavigationTestModelBuilder.DerivedContainmentNavigationWithDerivedAssociationSetCsdl();
            var model = this.GetParserResult(csdls);

            this.CheckEntityTypeNavigationCount(model, "NS.Person", 1);
            this.CheckEntityTypeNavigationCount(model, "NS.Employee", 2);
            this.CheckEntityTypeNavigationCount(model, "NS.Home", 1);
            this.CheckEntityTypeNavigationCount(model, "NS.Office", 2);

            var personToHome = model.FindEntityType("NS.Person").NavigationProperties().First();

            this.CheckNavigationContainment(personToHome, true, false);
            var homeToPerson = model.FindEntityType("NS.Home").NavigationProperties().First();

            this.CheckNavigationContainment(homeToPerson, false, true);
            this.CheckNavigationsArePartners(personToHome, homeToPerson);

            var employeeToOffice = model.FindEntityType("NS.Employee").NavigationProperties().Where(n => n.Name.Equals("ToOffice")).First();

            this.CheckNavigationContainment(employeeToOffice, true, false);
            var officeToEmployee = model.FindEntityType("NS.Office").NavigationProperties().Where(n => n.Name.Equals("ToEmployee")).First();

            this.CheckNavigationContainment(officeToEmployee, false, true);
            this.CheckNavigationsArePartners(employeeToOffice, officeToEmployee);

            var container   = model.EntityContainer;
            var employeeSet = container.FindEntitySet("EmployeeSet");
            var officeSet   = container.FindEntitySet("OfficeSet");

            Assert.AreEqual(officeSet.FindNavigationTarget(homeToPerson), employeeSet, "Invalid entity set navigation target.");

            // Contained entity set is generated dynamically.
            // Assert.AreEqual(employeeSet.FindNavigationTarget(homeToPerson.Partner), officeSet, "Invalid entity set navigation target.");
        }