// [Test] Not intended for test execution, just want to verify compilation, see comment in the method public void TheInternalMethodsShouldBeAvailableFromTestProject() { CrsTransformationResult._CreateCrsTransformationResult(null,null,null,true,null,null); // The above "internal" factory method works from this 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> // Note that another test project have been created // without the above kind of configuration and from // there the internal method does indeed (as expected) not work // i.e. the code does not even compile if trying to use it. }
private CrsTransformationResult CreateCrsTransformationResult( CrsCoordinate outputCoordinate, ICrsTransformationAdapter adapter, CrsCoordinate inputCoordinateNotUsedInThisTest ) { Exception exceptionNull = null; bool isSuccessTrue = true; return CrsTransformationResult._CreateCrsTransformationResult( inputCoordinateNotUsedInThisTest, outputCoordinate, exceptionNull, isSuccessTrue, adapter, CrsTransformationResultStatistic._CreateCrsTransformationResultStatistic(new List<CrsTransformationResult>()) ); }
public void TransformResult_ShouldReturnStatisticsObjectWithCorrectAverageAndMeanAndMaxDiffValues_WhenCreatingResultWithListOfSubresults() { // Both the setup code and the verify/assertion code for this test method // is placed in a base class because it is reused from another test class. // The keyword "super" is used below to make that more obvious. CrsTransformationResult transformResult = CrsTransformationResult._CreateCrsTransformationResult( base.inputCoordinateNotUsedInStatisticsTest, base.outputCoordinateNotUsedInStatisticsTest, null, true, base.compositeAdapterForResultTest, CrsTransformationResultStatistic._CreateCrsTransformationResultStatistic(base.listOfSubresultsForStatisticsTest) ); CrsTransformationResultStatistic crsTransformationResultStatistic = transformResult.CrsTransformationResultStatistic; base.AssertCrsTransformationResultStatistic(crsTransformationResultStatistic); }
// Lots of method in this test class creates a // CrsTransformationResult with three of the six // parameters being exactly the same. // For that reason this helper method is used, // i.e. to not duplicate the three // parameters almost always being the same. private CrsTransformationResult CreateCrsTransformationResult( //CrsCoordinate inputCoordinate: , CrsCoordinate outputCoordinate, Exception exceptionOrNull, bool isSuccess //crsTransformationAdapterResultSource: ICrsTransformationAdapter, //nullableCrsTransformationResultStatistic: CrsTransformationResultStatistic// = null ) { var transformResult = CrsTransformationResult._CreateCrsTransformationResult( inputCoordinate, outputCoordinate, exceptionOrNull, isSuccess, base.compositeAdapterForResultTest, CrsTransformationResultStatistic._CreateCrsTransformationResultStatistic(base.listOfSubresultsForStatisticsTest) ); return transformResult; }
public void SetUp() { weightFactory = CrsTransformationAdapterWeightFactory.Create(); crsTransformationAdapterCompositeFactory = CrsTransformationAdapterCompositeFactory.Create(); double[] outputLatitudes = { 59.1, 59.2, 59.3, 59.4, 59.6, }; expectedMedianLatitude = 59.3; expectedAverageLatitude = 59.32; double[] outputLongitudes = { 18.2, 18.3, 18.4, 18.8, 18.9 }; expectedMedianLongitude = 18.4; expectedAverageLongitude = 18.52; outputCoordinateWgs84ForImplementation_1 = CrsCoordinateFactory.CreateFromLatitudeLongitude(outputLatitudes[0], outputLongitudes[3]); outputCoordinateWgs84ForImplementation_2 = CrsCoordinateFactory.CreateFromLatitudeLongitude(outputLatitudes[2], outputLongitudes[1]); outputCoordinateWgs84ForImplementation_3 = CrsCoordinateFactory.CreateFromLatitudeLongitude(outputLatitudes[4], outputLongitudes[4]); outputCoordinateWgs84ForImplementation_4 = CrsCoordinateFactory.CreateFromLatitudeLongitude(outputLatitudes[1], outputLongitudes[0]); outputCoordinateWgs84ForImplementation_5 = CrsCoordinateFactory.CreateFromLatitudeLongitude(outputLatitudes[3], outputLongitudes[2]); outputCoordinates = new List <CrsCoordinate> { outputCoordinateWgs84ForImplementation_1, outputCoordinateWgs84ForImplementation_2, outputCoordinateWgs84ForImplementation_3, outputCoordinateWgs84ForImplementation_4, outputCoordinateWgs84ForImplementation_5 }; mock1 = new Mock <ICrsTransformationAdapter>(); mock2 = new Mock <ICrsTransformationAdapter>(); mock3 = new Mock <ICrsTransformationAdapter>(); mock4 = new Mock <ICrsTransformationAdapter>(); mock5 = new Mock <ICrsTransformationAdapter>(); leafAdapterImplementation_1 = mock1.Object; leafAdapterImplementation_2 = mock2.Object; leafAdapterImplementation_3 = mock3.Object; leafAdapterImplementation_4 = mock4.Object; leafAdapterImplementation_5 = mock5.Object; inputCoordinateSweref99 = CrsCoordinateFactory.CreateFromYNorthingLatitudeAndXEastingLongitude(6580822.0, 674032.0, EpsgNumber.SWEDEN__SWEREF99_TM__3006); CrsTransformationResult leafResult1 = CrsTransformationResult._CreateCrsTransformationResult( inputCoordinateSweref99, outputCoordinateWgs84ForImplementation_1, null, true, leafAdapterImplementation_1, CrsTransformationResultStatistic._CreateCrsTransformationResultStatistic(new List <CrsTransformationResult>()) ); CrsTransformationResult leafResult2 = CrsTransformationResult._CreateCrsTransformationResult( inputCoordinateSweref99, outputCoordinateWgs84ForImplementation_2, null, true, leafAdapterImplementation_2, CrsTransformationResultStatistic._CreateCrsTransformationResultStatistic(new List <CrsTransformationResult>()) ); CrsTransformationResult leafResult3 = CrsTransformationResult._CreateCrsTransformationResult( inputCoordinateSweref99, outputCoordinateWgs84ForImplementation_3, null, true, leafAdapterImplementation_3, CrsTransformationResultStatistic._CreateCrsTransformationResultStatistic(new List <CrsTransformationResult>()) ); CrsTransformationResult leafResult4 = CrsTransformationResult._CreateCrsTransformationResult( inputCoordinateSweref99, outputCoordinateWgs84ForImplementation_4, null, true, leafAdapterImplementation_4, CrsTransformationResultStatistic._CreateCrsTransformationResultStatistic(new List <CrsTransformationResult>()) ); CrsTransformationResult leafResult5 = CrsTransformationResult._CreateCrsTransformationResult( inputCoordinateSweref99, outputCoordinateWgs84ForImplementation_5, null, true, leafAdapterImplementation_5, CrsTransformationResultStatistic._CreateCrsTransformationResultStatistic(new List <CrsTransformationResult>()) ); crsIdentifierWGS84 = CrsIdentifierFactory.CreateFromEpsgNumber(EpsgNumber.WORLD__WGS_84__4326); mock1.Setup(leaf => leaf.Transform(inputCoordinateSweref99, crsIdentifierWGS84)).Returns(leafResult1); mock2.Setup(leaf => leaf.Transform(inputCoordinateSweref99, crsIdentifierWGS84)).Returns(leafResult2); mock3.Setup(leaf => leaf.Transform(inputCoordinateSweref99, crsIdentifierWGS84)).Returns(leafResult3); mock4.Setup(leaf => leaf.Transform(inputCoordinateSweref99, crsIdentifierWGS84)).Returns(leafResult4); mock5.Setup(leaf => leaf.Transform(inputCoordinateSweref99, crsIdentifierWGS84)).Returns(leafResult5); //mock1.Setup(leaf => leaf.LongNameOfImplementation).Returns("1"); //mock2.Setup(leaf => leaf.LongNameOfImplementation).Returns("2"); //mock3.Setup(leaf => leaf.LongNameOfImplementation).Returns("3"); //mock4.Setup(leaf => leaf.LongNameOfImplementation).Returns("4"); //mock5.Setup(leaf => leaf.LongNameOfImplementation).Returns("5"); mock1.Setup(leaf => leaf.AdapteeType).Returns(CrsTransformationAdapteeType.LEAF_DOT_SPATIAL_2_0_0_RC1); mock2.Setup(leaf => leaf.AdapteeType).Returns(CrsTransformationAdapteeType.LEAF_PROJ_NET_2_0_0); mock3.Setup(leaf => leaf.AdapteeType).Returns(CrsTransformationAdapteeType.LEAF_MIGHTY_LITTLE_GEODESY_1_0_2); // The type must be different but there are only three concrete types as above to use // but then instead can use the ones below (and the purpose of this enum is to use it as key in a dictionary/hashtable) mock4.Setup(leaf => leaf.AdapteeType).Returns(CrsTransformationAdapteeType.UNSPECIFIED_LEAF); mock5.Setup(leaf => leaf.AdapteeType).Returns(CrsTransformationAdapteeType.UNSPECIFIED); allLeafAdapters = new List <ICrsTransformationAdapter> { leafAdapterImplementation_1, leafAdapterImplementation_2, leafAdapterImplementation_3, leafAdapterImplementation_4, leafAdapterImplementation_5 }; }