public void Can_get_type_from_name()
        {
            var providerManifest = new SqlProviderManifest("2008");

            Assert.NotNull(providerManifest.GetStoreTypeFromName("nvarchar(max)"));
            Assert.NotNull(providerManifest.GetStoreTypeFromName("Datetime2"));
            Assert.NotNull(providerManifest.GetStoreTypeFromName("TINYINT"));
        }
        public void Get_non_existing_type_throws()
        {
            var          providerManifest = new SqlProviderManifest("2008");
            const string typeName         = "nvarchat";

            Action test =
                () => providerManifest.GetStoreTypeFromName(typeName);

            Assert.Equal(
                Strings.StoreTypeNotFound(typeName, providerManifest.NamespaceName),
                Assert.Throws <InvalidOperationException>(test).Message);
        }
Пример #3
0
        public void Can_get_and_set_provider_manifest()
        {
            var model = new EdmModel(DataSpace.SSpace);

            Assert.Null(model.ProviderManifest);

            var providerManifest = new SqlProviderManifest("2008");

            model.ProviderManifest = providerManifest;

            Assert.Same(providerManifest, model.ProviderManifest);
        }
Пример #4
0
        private EdmModel CreateTestModel()
        {
            var model = new EdmModel(DataSpace.SSpace);

            var sqlManifest     = new SqlProviderManifest("2008");
            var stringTypeUsage = sqlManifest.GetStoreType(
                TypeUsage.CreateDefaultTypeUsage(
                    PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)));

            var complexType = new ComplexType("Entity", "Unicorns420", DataSpace.SSpace);

            complexType.AddMember(new EdmProperty("NullableProperty", stringTypeUsage)
            {
                Nullable = true
            });
            complexType.AddMember(new EdmProperty("NonNullableProperty", stringTypeUsage)
            {
                Nullable = false
            });
            model.AddItem(complexType);

            return(model);
        }