public void ShortQualifiedNameForCollectionPrimitiveTypeShouldBeCollectionOfName() { foreach (EdmPrimitiveTypeKind edmPrimitiveTypeKind in Enum.GetValues(typeof(EdmPrimitiveTypeKind))) { if (EdmPrimitiveTypeKind.None == edmPrimitiveTypeKind) { continue; } var stringOfName = Enum.GetName(typeof(EdmPrimitiveTypeKind), edmPrimitiveTypeKind); stringOfName.ToUpper().Should().NotContain("EDM."); var stringOfExpectedShortQulifiedName = String.Format("Collection({0})", stringOfName); var iEdmPrimitiveType = EdmCoreModel.Instance.GetPrimitiveType(edmPrimitiveTypeKind); var edmCollectionType = new EdmCollectionType(new EdmPrimitiveTypeReference(iEdmPrimitiveType, true)); var stringOfObservedShortQulifiedName = edmCollectionType.ODataShortQualifiedName(); stringOfObservedShortQulifiedName.Should().Be(stringOfExpectedShortQulifiedName); } }
public void ShortQualifiedNameForCollectionOfNonPrimitiveTypeShouldBeCollectionOfFullName() { const string stringOfNamespaceName = "TestModel"; const string stringOfComplexTypeName = "MyComplexType"; var edmComplexType = new EdmComplexType(stringOfNamespaceName, stringOfComplexTypeName); var edmCollectionType = new EdmCollectionType(new EdmComplexTypeReference(edmComplexType, true)); var stringOfExpectedShortQulifiedName = String.Format("Collection({0}.{1})", stringOfNamespaceName, stringOfComplexTypeName); var stringOfObservedShortQulifiedName = edmCollectionType.ODataShortQualifiedName(); stringOfObservedShortQulifiedName.Should().Be(stringOfExpectedShortQulifiedName); const string stringEntityTypeName = "MyEntityType"; var edmEntityType = new EdmEntityType(stringOfNamespaceName, stringEntityTypeName); edmCollectionType = new EdmCollectionType(new EdmEntityTypeReference(edmEntityType, true)); stringOfExpectedShortQulifiedName = String.Format("Collection({0}.{1})", stringOfNamespaceName, stringEntityTypeName); stringOfObservedShortQulifiedName = edmCollectionType.ODataShortQualifiedName(); stringOfObservedShortQulifiedName.Should().Be(stringOfExpectedShortQulifiedName); }