Ejemplo n.º 1
0
 public Bootstrapper(
     ILogger <Bootstrapper> logger,
     RedisService redisService,
     AttackService attackService,
     IpInfoService ipInfoService,
     SuspectDomainSevice suspectDomainSevice,
     NotifyService notifyService)
 {
     _logger              = logger;
     _redis               = redisService;
     _attackService       = attackService;
     _ipInfoService       = ipInfoService;
     _suspectDomainSevice = suspectDomainSevice;
     _notifyService       = notifyService;
 }
Ejemplo n.º 2
0
        public async Task GetInfoByIpTest()
        {
            var country = new Country()
            {
                Alpha2Code = "US",
                Name       = "United States of America"
            };
            Mock <ICache> cache = GetCache();

            Mock <ICache> cacheRate = CacheRate();

            var cacheCountry = CacheCountry();
            var reqCreator   = new Mock <IAPIRequestCreator>();

            var rateService    = new CurrencyRateService(cacheRate.Object, reqCreator.Object); // 10
            var countryService = new CountryService(cacheCountry, reqCreator.Object);

            var service = new IpInfoService(cache.Object, reqCreator.Object, countryService, rateService);
            var result  = await service.GetInfoByIp("1.2.3.4");

            Assert.AreEqual("US", result.Alpha2Code);
            Assert.AreEqual(10, result.Currencies.First().Rate);
        }