private static KeyValuePair <Type, string>[] BuildTypeMap(Type[] types) { Assert.IsTrue(types != null && types.Length > 0, "Expected a non-null and non-empty set of types to build the type map for the test."); KeyValuePair <Type, string>[] mappedPrimitiveTypes = new KeyValuePair <Type, string> [types.Length]; for (int i = 0; i < types.Length; i++) { mappedPrimitiveTypes[i] = new KeyValuePair <Type, string>(types[i], ProviderMemberSimulator.GetEdmTypeName(types[i])); } return(mappedPrimitiveTypes); }
public void VerifyPopulateMemberMetadataFailsOnEnumPropertyOnEntityType() { Type entityClrType = typeof(TestEntityTypeWithEnum); Type[] primitiveTypes = new Type[] { typeof(string) }; PrimitiveResourceTypeMap typeMap; ResourceType entityResourceType; ProviderMetadataSimulator workspace; SetupTestMetadata(entityClrType, primitiveTypes, out entityResourceType, out workspace, out typeMap); Action test = () => ObjectContextServiceProvider.PopulateMemberMetadata(new ResourceTypeCacheItem(entityResourceType), workspace, null, typeMap); test.ShouldThrow <NotSupportedException>().WithMessage(Strings.ObjectContext_PrimitiveTypeNotSupported("EnumProperty", entityClrType.Name, ProviderMemberSimulator.GetEdmTypeName(typeof(Enum)))); }