public void SerializeDerivedContainmentNavigationWithDerivedAndBaseAssociationSet() { var model = NavigationTestModelBuilder.DerivedContainmentNavigationWithDerivedAndBaseAssociationSet(); var csdls = NavigationTestModelBuilder.DerivedContainmentNavigationWithDerivedAndBaseAssociationSetCsdl(); this.SerializingValidator(model, csdls); }
public void ParsingDerivedContainmentNavigationWithDerivedAndBaseAssociationSetCsdl() { var csdls = NavigationTestModelBuilder.DerivedContainmentNavigationWithDerivedAndBaseAssociationSetCsdl(); 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 personSet = container.FindEntitySet("PersonSet"); var employeeSet = container.FindEntitySet("EmployeeSet"); var homeSet = container.FindEntitySet("HomeSet"); var officeSet = container.FindEntitySet("OfficeSet"); Assert.AreEqual(officeSet.FindNavigationTarget(employeeToOffice.Partner), personSet, "Invalid entity set navigation target."); // Contained entity set is generated dynamically. // Assert.AreEqual(employeeSet.FindNavigationTarget(personToHome), homeSet, "Invalid entity set navigation target."); // Assert.AreEqual(personSet.FindNavigationTarget(employeeToOffice), officeSet, "Invalid entity set navigation target."); Assert.AreEqual(homeSet.FindNavigationTarget(personToHome.Partner), employeeSet, "Invalid entity set navigation target."); }