Ejemplo n.º 1
0
        public void Should_NotHaveAnAuthType()
        {
            var configuration = new AzureMapsConfiguration();

            Assert.Null(configuration.AuthType);
            Assert.False(configuration.Validate());
        }
Ejemplo n.º 2
0
 public AzureMapsService(ILogger <AzureMapsService> logger, AzureMapsConfiguration azureMapsConfiguration,
                         HttpClient httpClient)
 {
     this.Logger = logger;
     this.AzureMapsConfiguration = azureMapsConfiguration;
     this.HttpClient             = httpClient;
 }
Ejemplo n.º 3
0
 public AzureMapsController(AzureMapsConfiguration azureMapsConfiguration,
                            PTI.Microservices.Library.Services.AzureMapsService azureMapsService
                            )
 {
     this.azureMapsConfiguration = azureMapsConfiguration;
     this.azureMapsService       = azureMapsService;
 }
        public AzureMapFixture()
        {
            MapService = new Mock <IMapAdderService>();
            JsRuntime  = new Mock <IMapJsRuntime>();
            Logger     = new Mock <ILogger <AzureMap> >();

            Configuration = new AzureMapsConfiguration();
            TestContext   = new TestContext();
        }
Ejemplo n.º 5
0
        public void Should_HaveAnonymousAuthType()
        {
            var configuration = new AzureMapsConfiguration {
                ClientId = "clientId"
            };

            Assert.Equal("anonymous", configuration.AuthType);
            Assert.True(configuration.Validate());
        }
Ejemplo n.º 6
0
 public AzMapsGeocoder(IConfiguration configuration, IHttpClientFactory clientFactory, CosmosClient CosmosClient)
 {
     config    = configuration;
     _settings = new AzureMapsConfiguration();
     config.GetSection("AzureMaps").Bind(_settings);
     _clientFactory = clientFactory;
     cosmosClient   = CosmosClient;
     inContainer    = cosmosClient.GetContainer("AzureMaps", "<SOURCE ADDRESS COSMOS DB COLLECTION NAME");
     gcContainer    = cosmosClient.GetContainer("AzureMaps", "<OUTPUT COLLECTION NAME>");
 }
Ejemplo n.º 7
0
        public void Should_HaveAddAuthType()
        {
            var configuration = new AzureMapsConfiguration {
                AadAppId  = "aadAppId",
                AadTenant = "aadTenant",
                ClientId  = "clientId",
            };

            Assert.Equal("aad", configuration.AuthType);
            Assert.True(configuration.Validate());
        }
Ejemplo n.º 8
0
        public void Should_HaveSubscriptionKeyAuthType()
        {
            var configuration = new AzureMapsConfiguration {
                AadAppId        = "aadAppId",
                AadTenant       = "aadTenant",
                ClientId        = "clientId",
                SubscriptionKey = "subscriptionKey"
            };

            Assert.Equal("subscriptionKey", configuration.AuthType);
            Assert.True(configuration.Validate());
        }
Ejemplo n.º 9
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            AzureMapsConfiguration azureMapsConfiguration = this.Configuration.GetSection("AzureMapsConfiguration")
                                                            .Get <AzureMapsConfiguration>();

            services.AddSingleton(azureMapsConfiguration);
            var azuremapsServiceConfig =
                new PTI.Microservices.Library.Configuration.AzureMapsConfiguration()
            {
                Key = azureMapsConfiguration.SubscriptionKey
            };

            PTI.Microservices.Library.Configuration.GlobalPackageConfiguration.RapidApiKey = "a3893edcbfmsh2efa1861dcc7a10p159864jsnf17e667d1bf7";
            services.AddSingleton(azuremapsServiceConfig);
            services.AddTransient <CustomHttpClientHandler>();
            services.AddTransient <CustomHttpClient>();
            services.AddTransient <AzureMapsService>();
            services.AddControllersWithViews();
            services.AddRazorPages();
        }