private void SetupValues() { IEdmEntityType person = (IEdmEntityType)this.baseModel.FindType("foo.Person"); IEdmEntityType professional = (IEdmEntityType)this.baseModel.FindType("foo.Professional"); IEdmEntityType address = (IEdmEntityType)this.baseModel.FindType("foo.Address"); // ?? no EdmComplexValue var zipMain = new EdmPropertyValue("Main", new EdmStringConstant("98052")); var zipExtension = new EdmPropertyValue("Extension", new EdmStringConstant("0000")); var zipValue = new EdmPropertyValue("Zip", new EdmStructuredValue(null, new EdmPropertyValue[] { zipMain, zipExtension })); EdmPropertyValue address1Number = new EdmPropertyValue("Number", new EdmIntegerConstant(null, 1)); EdmPropertyValue address1Street = new EdmPropertyValue("Street", new EdmStringConstant(null, "Joey Ramone Place")); EdmPropertyValue address1City = new EdmPropertyValue("City", new EdmStringConstant(null, "New York")); EdmPropertyValue address1State = new EdmPropertyValue("State", new EdmStringConstant(null, "New York")); EdmPropertyValue[] address1Properties = new EdmPropertyValue[] { address1Number, address1Street, address1City, address1State, zipValue }; EdmStructuredValue address1Value = new EdmStructuredValue(new EdmEntityTypeReference(address, true), address1Properties); var phoneLocal = new EdmPropertyValue("Local", new EdmIntegerConstant(9991234)); var phoneValue = new EdmPropertyValue("WorkPhone", new EdmStructuredValue(null, new EdmPropertyValue[] { phoneLocal })); var contactInfoValue = new EdmPropertyValue("ContactInfo", new EdmStructuredValue(null, new EdmPropertyValue[] { phoneValue })); EdmPropertyValue person1Name = new EdmPropertyValue("Name", new EdmStringConstant(null, "Joey Ramone")); EdmPropertyValue person1Birthday = new EdmPropertyValue("Birthday", new EdmDateTimeOffsetConstant(null, new DateTimeOffset(1951, 5, 19, 0, 0, 0, TimeSpan.Zero))); EdmPropertyValue person1CoolnessIndex = new EdmPropertyValue("CoolnessIndex", new EdmIntegerConstant(null, Int32.MaxValue)); EdmPropertyValue person1Living = new EdmPropertyValue("Living", new EdmBooleanConstant(false)); EdmPropertyValue person1Famous = new EdmPropertyValue("Famous", new EdmBooleanConstant(null, true)); EdmPropertyValue person1Address = new EdmPropertyValue("Address", address1Value); EdmPropertyValue[] person1Properties = new EdmPropertyValue[] { person1Name, person1Birthday, person1CoolnessIndex, person1Living, person1Famous, person1Address, contactInfoValue }; this.personValue = new EdmStructuredValue(new EdmEntityTypeReference(person, false), person1Properties); this.professionalValue = new EdmStructuredValue(new EdmEntityTypeReference(professional, false), person1Properties); }
public void TestElementInterfaceCriticalEnumerableMustNotHaveNullElements() { var expectedErrors = new EdmLibTestErrors() { { null, null, EdmErrorCode.InterfaceCriticalEnumerableMustNotHaveNullElements } }; EdmPropertyValue personName = new EdmPropertyValue("Name", new EdmStringConstant("foo")); EdmPropertyValue[] properties = new EdmPropertyValue[] { personName, null }; var structuralValue = new EdmStructuredValue(new EdmEntityTypeReference(new EdmEntityType("", ""), false), properties); var actualErrors = structuralValue.Errors(); Assert.IsTrue(structuralValue.IsBad(), "Element is expected to be bad."); this.CompareErrors(actualErrors, expectedErrors); }