private void SetupHighways(List <LineString> lineStrings = null)
        {
            lineStrings = lineStrings ?? new List <LineString>();
            var conveter = new ItmWgs84MathTransfromFactory().Create();
            var highways = lineStrings.Select(l => new Feature(new LineString(l.Coordinates.Select(conveter.Transform).ToArray()), new AttributesTable())).ToList();

            foreach (var highway in highways)
            {
                highway.Attributes.AddAttribute(FeatureAttributes.ID, "1");
            }
            _elasticSearchGateway.GetHighways(Arg.Any <Coordinate>(), Arg.Any <Coordinate>()).Returns(highways);
        }
예제 #2
0
        public void TestInitialize()
        {
            var options = new ConfigurationData
            {
                MinimalSplitSimplificationTolerace = 50,
                MaxSegmentsNumber    = 40,
                MinimalSegmentLength = 500
            };
            var optionsProvider = Substitute.For <IOptions <ConfigurationData> >();

            optionsProvider.Value.Returns(options);

            _service = new RouteDataSplitterService(ItmWgs84MathTransfromFactory.Create(), optionsProvider);
        }
예제 #3
0
        public void TestInitialize()
        {
            _elasticSearchGateway = Substitute.For <IElasticSearchGateway>();
            var geoJsonPreProcessor = Substitute.For <IOsmGeoJsonPreprocessorExecutor>();

            _httpGatewayFactory = Substitute.For <IHttpGatewayFactory>();
            var options = new ConfigurationData
            {
                ClosestPointTolerance = 30,
                DistanceToExisitngLineMergeThreshold = 1
            };
            var optionsProvider = Substitute.For <IOptions <ConfigurationData> >();

            optionsProvider.Value.Returns(options);

            _service = new OsmLineAdderService(_elasticSearchGateway, ItmWgs84MathTransfromFactory.Create(), optionsProvider, geoJsonPreProcessor, _httpGatewayFactory);
        }
예제 #4
0
파일: RegisterApi.cs 프로젝트: arielki/Site
 /// <summary>
 /// Registers all the API layer services
 /// </summary>
 /// <param name="services">The <see cref="IServiceCollection"/> to use for registration</param>
 /// <returns></returns>
 public static IServiceCollection AddIHMApi(this IServiceCollection services)
 {
     services.AddTransient <IGpxGeoJsonConverter, GpxGeoJsonConverter>();
     services.AddTransient <IGpxDataContainerConverter, GpxDataContainerConverter>();
     services.AddTransient <IOsmGeoJsonConverter, OsmGeoJsonConverter>();
     services.AddTransient <IDataContainerConverterService, DataContainerConverterService>();
     services.AddTransient <IRouteDataSplitterService, RouteDataSplitterService>();
     services.AddTransient <IGpxProlongerExecutor, GpxProlongerExecutor>();
     services.AddTransient <IGpxLoopsSplitterExecutor, GpxLoopsSplitterExecutor>();
     services.AddTransient <IAddibleGpxLinesFinderService, AddibleGpxLinesFinderService>();
     services.AddTransient <IOsmGeoJsonPreprocessorExecutor, OsmGeoJsonPreprocessorExecutor>();
     services.AddSingleton <LruCache <string, TokenAndSecret> >();
     services.AddTransient <IImageCreationService, ImageCreationService>();
     services.AddTransient <IOsmLineAdderService, OsmLineAdderService>();
     services.AddTransient <ITagsHelper, TagsHelper>();
     services.AddTransient <IPointsOfInterestAdapter, OsmPointsOfInterestAdapter>();
     services.AddTransient <IPointsOfInterestAdapter, NakebPointsOfInterestAdapter>();
     services.AddTransient <IPointsOfInterestAdapter, OffRoadPointsOfInterestAdapter>();
     services.AddTransient <IMathTransform>(s => ItmWgs84MathTransfromFactory.Create());
     return(services);
 }
예제 #5
0
 public void TestInitialize()
 {
     _httpGatewayFactory = Substitute.For<IHttpGatewayFactory>();
     _dataContainerConverterService = Substitute.For<IDataContainerConverterService>();
     _elasticSearchGateway = Substitute.For<IElasticSearchGateway>();
     _addibleGpxLinesFinderService = Substitute.For<IAddibleGpxLinesFinderService>();
     _osmLineAdderService = Substitute.For<IOsmLineAdderService>();
     _options = new ConfigurationData();
     var optionsProvider = Substitute.For<IOptions<ConfigurationData>>();
     optionsProvider.Value.Returns(_options);
     _controller = new OsmController(_httpGatewayFactory, _dataContainerConverterService, ItmWgs84MathTransfromFactory.Create(), 
         _elasticSearchGateway, _addibleGpxLinesFinderService, _osmLineAdderService, optionsProvider, GeometryFactory.Default,
         new LruCache<string, TokenAndSecret>(optionsProvider, Substitute.For<ILogger>()));
 }
예제 #6
0
 public void TestInitialize()
 {
     _parser = new UtmParser(ItmWgs84MathTransfromFactory.Create());
 }
예제 #7
0
        public void TestInitialize()
        {
            _elasticSearchGateway = Substitute.For <IElasticSearchGateway>();
            _options = new ConfigurationData();
            var optionsProvider = Substitute.For <IOptions <ConfigurationData> >();

            optionsProvider.Value.Returns(_options);
            var geometryFactory = GeometryFactory.Default;

            _service = new AddibleGpxLinesFinderService(new GpxLoopsSplitterExecutor(geometryFactory), new GpxProlongerExecutor(geometryFactory), ItmWgs84MathTransfromFactory.Create(), _elasticSearchGateway, optionsProvider, geometryFactory, Substitute.For <ILogger>());
        }
예제 #8
0
        public void TestInitialize()
        {
            _gpsBabelGateway          = Substitute.For <IGpsBabelGateway>();
            _elevationDataStorage     = Substitute.For <IElevationDataStorage>();
            _remoteFileFetcherGateway = Substitute.For <IRemoteFileFetcherGateway>();
            var factory = Substitute.For <IHttpGatewayFactory>();

            factory.CreateRemoteFileFetcherGateway(Arg.Any <TokenAndSecret>()).Returns(_remoteFileFetcherGateway);
            _gpxDataContainerConverter = new GpxDataContainerConverter();
            var optionsProvider = Substitute.For <IOptions <ConfigurationData> >();

            optionsProvider.Value.Returns(new ConfigurationData());
            _dataContainerConverterService = new DataContainerConverterService(_gpsBabelGateway, new GpxGeoJsonConverter(), _gpxDataContainerConverter, new RouteDataSplitterService(ItmWgs84MathTransfromFactory.Create(), optionsProvider));
            _controller = new FilesController(_elevationDataStorage, factory, _dataContainerConverterService, new LruCache <string, TokenAndSecret>(optionsProvider, Substitute.For <ILogger>()));
        }
예제 #9
0
        public void TestInitialize()
        {
            _elasticSearchGateway = Substitute.For <IElasticSearchGateway>();
            var elevationDataStorage = Substitute.For <IElevationDataStorage>();

            _dataContainerConverterService = Substitute.For <IDataContainerConverterService>();
            _controller = new SearchController(_elasticSearchGateway, _dataContainerConverterService, elevationDataStorage, ItmWgs84MathTransfromFactory.Create());
        }