Esempio n. 1
0
 public GmapsClientFixture()
 {
     secretManager       = new UserSecretManager();
     gmapsApiKey         = secretManager.GetGmapsGeocodeApiKey();
     gmapsGeocodeClient  = new GmapsGeocodeClient(gmapsApiKey);
     testAddress         = "Av.Vallarta y Niño Obrero, por la cámara de comercio de Guadalajara.";
     geoCodeResponseTask = gmapsGeocodeClient.GetGeocodeForAddress(testAddress);
 }
Esempio n. 2
0
        //internal readonly Task<GeoCodeResponse> geoCodeResponseTask;
        public ToritoCoreTestsFixture()
        {
            SecretManager = new UserSecretManager();
            var gmapsApiKey = SecretManager.GetGmapsGeocodeApiKey();

            GmapsGeocodeClient = new GmapsGeocodeClient(gmapsApiKey);

            // Mappper.
            var mapper = new MapperConfiguration(cfg => cfg.AddProfile(typeof(DataMapperProfile)))
                         .CreateMapper();

            Mapper = mapper;

            // Cleaners.
            AddressCleanReceiver     = new AddressCleanReceiver();
            ParenthesisCleanReceiver = new ParenthesisCleanReceiver();
            RetweetCleanReceiver     = new RetweetCleanReceiver();
            HashtagsCleanReceiver    = new HashtagsCleanReceiver();

            // Cleaner Handler.
            TweetDboCleanerHandler = new TweetDboAddressCleanHandler(
                new IReceiver <TweetDbo>[]
            {
                AddressCleanReceiver,
                AlcoholimetroCleanReceiver,
                RetweetCleanReceiver,
                ParenthesisCleanReceiver,
                HashtagsCleanReceiver,
            });
            // Clean Service.
            AddressCleanService = new AddressCleanService(TweetDboCleanerHandler);

            // Inmemory DB.
            var contextOptions = new DbContextOptionsBuilder <ToritoContext>()
                                 .UseInMemoryDatabase("ToritoDevInMemory")
                                 .Options;

            // Db.
            ToritoContext = new ToritoContext(contextOptions);
            ToritoContext.Database.EnsureCreated();
            TweetDbRepository = new TweetDbRepository(ToritoContext, mapper);
            LocationService   = new TweetLocationService(TweetDbRepository, AddressCleanService, GmapsGeocodeClient, Mapper);
        }