public void TestElementInterfaceCriticalComplexTypeBaseType() { var expectedErrors = new EdmLibTestErrors() { { null, null, EdmErrorCode.InterfaceCriticalPropertyValueMustNotBeNull }, { null, null, EdmErrorCode.InterfaceCriticalPropertyValueMustNotBeNull }, }; var baseComplexType = new StubEdmComplexType(null, null); var property = new StubEdmStructuralProperty("") { DeclaringType = baseComplexType }; baseComplexType.Add(property); this.ValidateElement(baseComplexType, expectedErrors); var derivedComplexType = new EdmComplexType("", "", baseComplexType, false); expectedErrors = new EdmLibTestErrors(); this.ValidateElement(derivedComplexType, expectedErrors); }
public void ValidateOpenComplexTypeSupported() { var ct = new StubEdmComplexType("NS1", "CT1") { IsOpen = true }; ct.Add(new EdmStructuralProperty(ct, "p1", EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Int16, true))); var model = new EdmModel(); model.AddElement(ct); IEnumerable<EdmError> errors; foreach (var v in new[] { Microsoft.OData.Edm.Library.EdmConstants.EdmVersionLatest }) { model.SetEdmVersion(v); model.Validate(out errors); Assert.AreEqual(0, errors.Count(), "No error should be returned"); } }
public static IEdmModel ModelWithEntityTypeWithComplexBaseType() { EdmModel model = new EdmModel(); var entity1 = new StubEdmEntityType("Foo", "Bar"); var id1 = new EdmStructuralProperty(entity1, "Id", EdmCoreModel.Instance.GetInt16(false), null, EdmConcurrencyMode.None); entity1.Add(id1); entity1.SetKey(id1); StubEdmComplexType complex1 = new StubEdmComplexType("Foo", "Baz"); complex1.Add(new EdmStructuralProperty(complex1, "Data", EdmCoreModel.Instance.GetString(true))); entity1.BaseType = complex1; model.AddElement(entity1); model.AddElement(complex1); return model; }