public void GetFacetDescriptions_returns_correct_facets_for_all_primitive_types() { var storeTypes = ProviderManifestWrapper .GetStoreTypes() .OrderBy(t => t.Name) .ToArray(); var legacyStoreTypes = LegacyProviderManifest .GetStoreTypes() .OrderBy(t => t.Name) .ToArray(); for (var i = 0; i < storeTypes.Length; i++) { var facetDescriptions = ProviderManifestWrapper.GetFacetDescriptions(storeTypes[i]).OrderBy(f => f.FacetName).ToArray(); var legacyFacetDescriptions = LegacyProviderManifest.GetFacetDescriptions(legacyStoreTypes[i]).OrderBy(f => f.FacetName).ToArray(); Assert.Equal(facetDescriptions.Length, legacyFacetDescriptions.Length); for (var j = 0; j < facetDescriptions.Count(); j++) { TypeUsageVerificationHelper.VerifyFacetDescriptionsEquivalent(facetDescriptions[j], legacyFacetDescriptions[j]); } } }
public override ReadOnlyCollection <FacetDescription> GetFacetDescriptions(EdmType edmType) { Debug.Assert(edmType != null, "edmType != null"); Debug.Assert(edmType.BuiltInTypeKind == BuiltInTypeKind.PrimitiveType, "Primitive type expected."); Debug.Assert( (DataSpace)typeof(EdmType) .GetProperty("DataSpace", BindingFlags.Instance | BindingFlags.NonPublic) .GetValue(edmType) == DataSpace.SSpace, "Expected SSpace type."); try { var legacyStoreType = _legacyStoreTypes.Single(t => t.FullName == edmType.FullName); return(new ReadOnlyCollection <FacetDescription>( _wrappedProviderManifest .GetFacetDescriptions(legacyStoreType) .Select( legacyFacetDescription => (FacetDescription)FacetDescriptionConstructor.Invoke( BindingFlags.CreateInstance, null, new[] { legacyFacetDescription.FacetName, FromLegacyPrimitiveType((LegacyMetadata.PrimitiveType)legacyFacetDescription.FacetType), legacyFacetDescription.MinValue, legacyFacetDescription.MaxValue, legacyFacetDescription.DefaultValue == TypeUsageHelper.LegacyVariableValue ? TypeUsageHelper.VariableValue : legacyFacetDescription.DefaultValue, legacyFacetDescription.IsConstant, legacyStoreType.FullName }, CultureInfo.InvariantCulture)) .ToList())); } catch (SystemData.ProviderIncompatibleException exception) { throw new ProviderIncompatibleException(exception.Message, exception.InnerException); } }