/*
         * public void Test_TestSqlServer()
         * {
         *      string connectionString = @"initial catalog=EPSG;data source=localhost;Integrated Security=SSPI;";
         *      SqlConnection connection = new SqlConnection(connectionString);
         *
         *      CoordinateSystemEPSGFactory factory = new CoordinateSystemEPSGFactory(connection);
         *      ILinearUnit linearUnit = factory.CreateLinearUnit("9001");
         *      Assertion.AssertEquals("LinearUnit - untis per meter ",1.0,linearUnit.MetersPerUnit);
         *      Assertion.AssertEquals("LinearUnit - Authority","EPSG",linearUnit.Authority);
         *      Assertion.AssertEquals("LinearUnit - Remarks","Also known as International metre.",linearUnit.Remarks);
         *      connection.Close();
         * }
         */
        #endregion

        #region LinearUnit
        public void Test_LinearUnit()
        {
            try
            {
                ILinearUnit linearUnit = _factory.CreateLinearUnit("1");
                Assertion.Fail("Linear Unit - Exception should be thrown.");
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }
        /*
         * [Ignore("EPSG is not in the bin directory, so will fail")]
         * public void Test_Constructor2()
         * {
         *      CoordinateSystemEPSGFactory factory = CoordinateSystemEPSGFactory.UseDefaultDatabase();
         *      ILinearUnit linearUnit = factory.CreateLinearUnit("9001");
         *      Assertion.AssertEquals("LinearUnit - untis per meter ",1.0,linearUnit.MetersPerUnit);
         *      Assertion.AssertEquals("LinearUnit - Authority","EPSG",linearUnit.Authority);
         *      Assertion.AssertEquals("LinearUnit - Remarks","Also known as International metre.",linearUnit.Remarks);
         * }*/


        public void Test_TestAccessDB()
        {
            IDbConnection connection            = Global.GetEPSGDatabaseConnection();
            CoordinateSystemEPSGFactory factory = new CoordinateSystemEPSGFactory(connection);
            ILinearUnit linearUnit = factory.CreateLinearUnit("9001");

            Assertion.AssertEquals("LinearUnit - untis per meter ", 1.0, linearUnit.MetersPerUnit);
            Assertion.AssertEquals("LinearUnit - Authority", "EPSG", linearUnit.Authority);
            Assertion.AssertEquals("LinearUnit - Remarks", "Also known as International metre.", linearUnit.Remarks);
            connection.Close();
        }
        public void TestWriteUnit1()
        {
            ILinearUnit        linearUnit         = _factory.CreateLinearUnit("9001");
            TextWriter         textwriter         = new StringWriter();
            IndentedTextWriter indentedTextWriter = new IndentedTextWriter(textwriter);

            CoordinateSystemWktWriter.Write(linearUnit, indentedTextWriter);
            bool same = Compare.CompareAgainstString(Global.GetUnitTestRootDirectory() + @"\IO\LinearUnit.txt", textwriter.ToString());

            Assertion.AssertEquals("test 1", true, same);
        }
        public void Test_TestSqlServer()
        {
            string        connectionString = @"initial catalog=EPSG;data source=localhost;Integrated Security=SSPI;";
            SqlConnection connection       = new SqlConnection(connectionString);

            CoordinateSystemEPSGFactory factory = new CoordinateSystemEPSGFactory(connection);
            ILinearUnit linearUnit = factory.CreateLinearUnit("9001");

            Assertion.AssertEquals("LinearUnit - untis per meter ", 1.0, linearUnit.MetersPerUnit);
            Assertion.AssertEquals("LinearUnit - Authority", "EPSG", linearUnit.Authority);
            Assertion.AssertEquals("LinearUnit - Remarks", "Also known as International metre.", linearUnit.Remarks);
            connection.Close();
        }
예제 #5
0
 public void TestWriteLinearUnit()
 {
     ILinearUnit linearUnit = _factory.CreateLinearUnit("9001");
     string      test1      = CoordinateSystemXmlWriter.Write(linearUnit);
 }