public void GetStoragePrimitiveType_returns_null_for_unknown_type() { var ssdl = XElement.Parse( "<Schema Namespace=\"Model.Store\" Provider=\"System.Data.SqlClient\" ProviderManifestToken=\"2008\" Alias=\"Self\" xmlns=\"http://schemas.microsoft.com/ado/2009/11/edm/ssdl\" />"); using (var storageModel = new StorageEntityModel(null, ssdl)) { Assert.Null(storageModel.GetStoragePrimitiveType("foo")); } }
public void XNamespace_returns_element_namespace_if_element_not_null() { var element = new XElement("{urn:tempuri}element"); var modelManager = new Mock <ModelManager>(null, null).Object; var modelProvider = new Mock <XmlModelProvider>().Object; var entityDesignArtifactMock = new Mock <EntityDesignArtifact>(modelManager, new Uri("urn:dummy"), modelProvider); entityDesignArtifactMock.Setup(a => a.SchemaVersion).Returns(EntityFrameworkVersion.Version3); using (var storageModel = new StorageEntityModel(entityDesignArtifactMock.Object, element)) { Assert.Same(element.Name.Namespace, storageModel.XNamespace); } }
public void StoreTypeNameToStoreTypeMap_returns_type_map() { var ssdl = XElement.Parse( "<Schema Namespace=\"Model.Store\" Provider=\"System.Data.SqlClient\" ProviderManifestToken=\"2008\" Alias=\"Self\" xmlns=\"http://schemas.microsoft.com/ado/2009/11/edm/ssdl\" />"); using (var storageModel = new StorageEntityModel(null, ssdl)) { var typeMap = storageModel.StoreTypeNameToStoreTypeMap; Assert.Equal( SqlProviderServices.Instance.GetProviderManifest("2008").GetStoreTypes().Where(t => t.Name != "hierarchyid").Select(t => t.Name), typeMap.Keys); Assert.False(typeMap.Any(t => t.Key != t.Value.Name)); } }
public void XNamespace_returns_root_namespace_if_element_null() { var tmpElement = new XElement("{http://schemas.microsoft.com/ado/2009/11/edm/ssdl}Schema"); var modelManager = new Mock <ModelManager>(null, null).Object; var modelProvider = new Mock <XmlModelProvider>().Object; var enityDesignArtifiact = new Mock <EntityDesignArtifact>(modelManager, new Uri("urn:dummy"), modelProvider) { CallBase = true }.Object; enityDesignArtifiact.SetXObject( XDocument.Parse("<Edmx xmlns=\"http://schemas.microsoft.com/ado/2009/11/edmx\" />")); using (var storageModel = new StorageEntityModel(enityDesignArtifiact, tmpElement)) { storageModel.SetXObject(null); Assert.Equal("http://schemas.microsoft.com/ado/2009/11/edm/ssdl", storageModel.XNamespace); // resetting the element is required for clean up storageModel.SetXObject(tmpElement); } }
internal StorageEntityType(StorageEntityModel model, XElement element) : base(model, element) { }