コード例 #1
0
    public void SetUp() {
        weightFactory = CrsTransformationAdapterWeightFactory.Create();
        crsTransformationAdapterCompositeFactory = CrsTransformationAdapterCompositeFactory.Create();

        var dotSpatial = new CrsTransformationAdapterDotSpatial();
        var ProjNet = new CrsTransformationAdapterProjNet();
        var mightyLittleGeodesy = new CrsTransformationAdapterMightyLittleGeodesy();
        listOfAdaptersWithOneDuplicated = new List<ICrsTransformationAdapter>{
            dotSpatial,
            ProjNet,
            mightyLittleGeodesy,
            // Duplicate added below !
            new CrsTransformationAdapterDotSpatial()
        };

        listOfTwoAdaptersWithoutDotSpatial = new List<ICrsTransformationAdapter>{
            ProjNet,
            mightyLittleGeodesy
        };

        listOfWeightsWithOneDuplicated = new List<CrsTransformationAdapterWeight>{
            weightFactory.CreateFromInstance(dotSpatial, 1.0),
            weightFactory.CreateFromInstance(ProjNet, 2.0),
            weightFactory.CreateFromInstance(mightyLittleGeodesy, 3.0),
            // Duplicate added below !
            // (Duplicate regarding the class, the weight value is not relevant)
            weightFactory.CreateFromInstance(dotSpatial, 4.0)
        };

        CrsTransformationAdapterLeafFactory leafFactoryOnlyCreatingDotSpatialImplementationAsDefault = CrsTransformationAdapterLeafFactory.Create(new List<ICrsTransformationAdapter>{dotSpatial});
        compositeFactoryConfiguredWithLeafFactoryOnlyCreatingDotSpatialImplementationAsDefault = CrsTransformationAdapterCompositeFactory.Create(leafFactoryOnlyCreatingDotSpatialImplementationAsDefault);
    }
        public void test()
        {
            // The following method should NOT be possible to compile from this project
            // CrsTransformationResult._CreateCrsTransformationResult(null,null,null,true,null,null);

            // However, the exact same code above DOES indeed work
            // from the test project's
            // method 'CrsTransformationResultTest.internalMethodShouldBeAvailableFromTestProject'

            // Just for verifying that the following
            // does NOT compile from this project,
            // because it is an "internal" method.
            // However, it does work from the test project because
            // of this configuration of the proj file in the F# core project:
            //<ItemGroup>
            //  <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
            //    <_Parameter1>Programmerare.CrsTransformations.Test</_Parameter1>
            //  </AssemblyAttribute>
            //</ItemGroup>


            CrsTransformationAdapterBase c = null;
            // the below methods was previously exposed
            // but should NOT be so anymore
            //c._GetFileInfoVersion();
            //var res = c._TransformHook(null, null);
            //var coord = c._TransformToCoordinateHook(null, null);
            // Actually the above methods have now been renamed
            // to "Strategy" instead of "Hook" because of the
            // design pattern being used now after some refactoring
            // that prevented exposing of methods considering
            // the fact that "protected" can not be used in F#
            // and "internal" was not appropriate since
            // other assemblies are implemening the base type.

            CrsTransformationAdapterBaseLeaf cc = null;
            // the below method was previously exposed
            // but should NOT be so anymore i.e. should no longer even be possible to compile:
            //var coordinate = cc._TransformToCoordinateHookLeaf(null, null);

            // The below types was previously exposed as result types for the Create methods
            //CrsTransformationAdapterLeafFactoryWithHardcodedImplementations c1 = CrsTransformationAdapterLeafFactory.Create();
            //CrsTransformationAdapterLeafFactoryWithConfiguredImplementations c2 = CrsTransformationAdapterLeafFactory.Create(new List<ICrsTransformationAdapter>());
            // Now instead both types are instead only exposed through the base type as below
            CrsTransformationAdapterLeafFactory c1 = CrsTransformationAdapterLeafFactory.Create();
            CrsTransformationAdapterLeafFactory c2 = CrsTransformationAdapterLeafFactory.Create(new List <ICrsTransformationAdapter>());
        }
        public void SetUp()
        {
            classNameDotSpatial          = typeof(CrsTransformationAdapterDotSpatial).FullName;
            classNameProjNet             = typeof(CrsTransformationAdapterProjNet).FullName;
            classNameMightyLittleGeodesy = typeof(CrsTransformationAdapterMightyLittleGeodesy).FullName;

            factoryWithOnlyTheTwoLeafsDotSpatialAndProjNet = CrsTransformationAdapterLeafFactory.Create(
                new List <ICrsTransformationAdapter> {
                new CrsTransformationAdapterDotSpatial(),
                new CrsTransformationAdapterProjNet()
            }
                );

            crsTransformationAdapterLeafFactory        = CrsTransformationAdapterLeafFactory.Create();
            actualClassNamesForAllKnownImplementations = new List <string> {
                typeof(CrsTransformationAdapterDotSpatial).FullName,
                typeof(CrsTransformationAdapterProjNet).FullName,
                typeof(CrsTransformationAdapterMightyLittleGeodesy).FullName
            };
        }