예제 #1
0
        public void GeometryFromProviderValue_returns_null_for_null_value()
        {
            var nullSqlGeometry     = new SqlTypesAssemblyLoader().GetSqlTypesAssembly().SqlGeometryType.GetDeclaredProperty("Null");
            var convertedDbGeometry = SqlSpatialServices.Instance.GeometryFromProviderValue(nullSqlGeometry.GetValue(null, null));

            Assert.Same(null, convertedDbGeometry);
        }
예제 #2
0
        public void GeographyFromProviderValue_returns_null_for_null_value()
        {
            var nullSqlGeography = new SqlTypesAssemblyLoader().GetSqlTypesAssembly().SqlGeographyType
                                   .GetProperty("Null", BindingFlags.Static | BindingFlags.Public | BindingFlags.GetProperty);
            var convertedDbGeography = SqlSpatialServices.Instance.GeographyFromProviderValue(nullSqlGeography.GetValue(null, null));

            Assert.Same(null, convertedDbGeography);
        }
예제 #3
0
        public void GeometryFromProviderValue_returns_DbGeometry_for_non_null_value()
        {
            var dbGeometry  = DbGeometry.FromText("POINT (90 50)");
            var sqlGeometry = new SqlTypesAssemblyLoader().GetSqlTypesAssembly().ConvertToSqlTypesGeometry(dbGeometry);

            var convertedDbGeometry = SqlSpatialServices.Instance.GeometryFromProviderValue(sqlGeometry);

            Assert.Equal(dbGeometry.ProviderValue, convertedDbGeometry.ProviderValue);
            Assert.Equal(dbGeometry.CoordinateSystemId, convertedDbGeometry.CoordinateSystemId);
        }
 private bool IsKnownAssembly(Assembly assembly)
 {
     foreach (string sqlTypesAssembly in this._preferredSqlTypesAssemblies)
     {
         if (SqlTypesAssemblyLoader.AssemblyNamesMatch(assembly.FullName, new AssemblyName(sqlTypesAssembly)))
         {
             return(true);
         }
     }
     return(false);
 }
        public void GetSqlTypesAssembly_returns_specified_assembly()
        {
            SqlProviderServices.SqlServerTypesAssemblyName = SQL2008TypesName;
            try
            {
                var assemblyName = new SqlTypesAssemblyLoader().GetSqlTypesAssembly().SqlGeographyType.Assembly.FullName;

                Assert.True(assemblyName == SQL2008TypesName, assemblyName);
            }
            finally
            {
                SqlProviderServices.SqlServerTypesAssemblyName = null;
            }
        }
예제 #6
0
        public void GetSqlTypesAssembly_returns_specified_assembly()
        {
            SqlProviderServices.SqlServerTypesAssemblyName = SQL2008TypesName;
            try
            {
                var assemblyName = new SqlTypesAssemblyLoader().GetSqlTypesAssembly().SqlGeographyType.Assembly.FullName;

                Assert.True(assemblyName == SQL2008TypesName, assemblyName);
            }
            finally
            {
                SqlProviderServices.SqlServerTypesAssemblyName = null;
            }
        }
        public void GeometryFromProviderValue_returns_DbGeometry_for_non_null_value()
        {
            var dbGeometry = DbGeometry.FromText("POINT (90 50)");
            var sqlGeometry = new SqlTypesAssemblyLoader().GetSqlTypesAssembly().ConvertToSqlTypesGeometry(dbGeometry);

            var convertedDbGeometry = SqlSpatialServices.Instance.GeometryFromProviderValue(sqlGeometry);

            Assert.Equal(dbGeometry.ProviderValue, convertedDbGeometry.ProviderValue);
            Assert.Equal(dbGeometry.CoordinateSystemId, convertedDbGeometry.CoordinateSystemId);
        }
        public void GeometryFromProviderValue_returns_null_for_null_value()
        {
            var nullSqlGeometry = new SqlTypesAssemblyLoader().GetSqlTypesAssembly().SqlGeometryType
                .GetProperty("Null", BindingFlags.Static | BindingFlags.Public | BindingFlags.GetProperty);
            var convertedDbGeometry = SqlSpatialServices.Instance.GeometryFromProviderValue(nullSqlGeometry.GetValue(null));

            Assert.Same(null, convertedDbGeometry);
        }
        public void GetSqlTypesAssembly_on_dev_machine_returns_assembly_for_SQL_2012_native_types()
        {
            var assemblyName = new SqlTypesAssemblyLoader().GetSqlTypesAssembly().SqlGeographyType.Assembly.FullName;

            Assert.True(assemblyName == SQL2012TypesName, assemblyName);
        }
예제 #10
0
        public void GeographyFromProviderValue_returns_null_for_null_value()
        {
            var nullSqlGeography = new SqlTypesAssemblyLoader().GetSqlTypesAssembly().SqlGeographyType.GetDeclaredProperty("Null");
            var convertedDbGeography = SqlSpatialServices.Instance.GeographyFromProviderValue(nullSqlGeography.GetValue(null, null));

            Assert.Same(null, convertedDbGeography);
        }
예제 #11
0
        public void GetSqlTypesAssembly_on_dev_machine_returns_assembly_for_SQL_2012_native_types()
        {
            var assemblyName = new SqlTypesAssemblyLoader().GetSqlTypesAssembly().SqlGeographyType.Assembly.FullName;

            Assert.True(assemblyName == SQL2012TypesName, assemblyName);
        }
예제 #12
0
        public void TryGetSqlTypesAssembly_on_dev_machine_returns_assembly_for_SQL_native_types()
        {
            var assemblyName = new SqlTypesAssemblyLoader().TryGetSqlTypesAssembly().SqlGeographyType.Assembly.FullName;

            Assert.True(IsSqlTypesAssemblyName(assemblyName));
        }