public void LongNameOfImplementationTest()
        {
            string fullClassName = crsTransformationAdapter.GetType().FullName;

            Assert.AreEqual(
                fullClassName,  // expected
                crsTransformationAdapter.LongNameOfImplementation
                );
        }
Ejemplo n.º 2
0
        public void CreateFromStringWithFullClassNameForImplementation_ShouldSucceed_WhenTheClassIsImplementingTheExpectedInterface()
        {
            string nameOfClassImplementingTheInterfaceCrsTransformationAdapter = crsTransformationAdapterInstanceNotNull.GetType().FullName;
            double weightValue = 123;
            CrsTransformationAdapterWeight crsTransformationAdapterWeight = weightFactory.CreateFromStringWithFullClassNameForImplementation(
                nameOfClassImplementingTheInterfaceCrsTransformationAdapter,
                weightValue
                );

            Assert.IsNotNull(crsTransformationAdapterWeight);
            Assert.AreEqual(
                nameOfClassImplementingTheInterfaceCrsTransformationAdapter,
                crsTransformationAdapterWeight.CrsTransformationAdapter.GetType().FullName
                );
            Assert.AreEqual(
                weightValue, // expected
                crsTransformationAdapterWeight.Weight
                );
        }
Ejemplo n.º 3
0
        // -------------------------------------------------------------------------------------


        private TestResult RunAllTransformationsOfTheCoordinatesInTheGeneratedCsvFile(
            ICrsTransformationAdapter crsTransformationAdapter,
            IList <EpsgCrsAndAreaCodeWithCoordinates> coordinatesFromGeneratedCsvFile
            )
        {
            var stopWatch = new Stopwatch();

            stopWatch.Start();
            IList <TestResultItem> testResultItems = new List <TestResultItem>();
            int counter = 0;

            foreach (EpsgCrsAndAreaCodeWithCoordinates item in coordinatesFromGeneratedCsvFile)
            {
                CrsCoordinate           inputCoordinateWGS84              = CrsCoordinateFactory.CreateFromXEastingLongitudeAndYNorthingLatitude(item.centroidX, item.centroidY, EpsgNumber.WORLD__WGS_84__4326);
                CrsTransformationResult resultOfTransformationFromWGS84   = crsTransformationAdapter.Transform(inputCoordinateWGS84, item.epsgCrsCode);
                CrsTransformationResult resultOfTransformationBackToWGS84 = null;
                if (resultOfTransformationFromWGS84.IsSuccess)
                {
                    resultOfTransformationBackToWGS84 = crsTransformationAdapter.Transform(resultOfTransformationFromWGS84.OutputCoordinate, EpsgNumber.WORLD__WGS_84__4326);
                }
                testResultItems.Add(new TestResultItem(item, inputCoordinateWGS84, resultOfTransformationFromWGS84, resultOfTransformationBackToWGS84));
                if (counter++ % 500 == 0)                                                                                                                                                                       // just to show some progress
                {
                    Console.WriteLine(this.GetType().Name + " , counter: " + counter + " (of the total " + coordinatesFromGeneratedCsvFile.Count + ") for adapter " + crsTransformationAdapter.GetType().Name); // to show some progress
                }
                // if(counter > 300) break;
            }
            long totalNumberOfSecondsForAllTransformations = (long)stopWatch.Elapsed.TotalSeconds;

            Console.WriteLine("Total number of seconds for method runAllTransformationsOfTheCoordinatesInTheGeneratedCsvFile: " + totalNumberOfSecondsForAllTransformations);
            return(new TestResult(crsTransformationAdapter, totalNumberOfSecondsForAllTransformations, testResultItems));
        }