Exemple #1
0
 public Leaders(ILogger <Leaders> logger, IProcessLeaders processor, KongoOptions opts)
 {
     _logger     = logger;
     _httpClient = new HttpClient();
     _processor  = processor;
     _sb         = new StringBuilder();
     _opts       = opts;
 }
        public async Task ProcessLeaders(string value)
        {
            var storage = new KongoDataStorage($"Data Source={Path.GetRandomFileName()}");

            storage.Database.EnsureCreated();
            var opts = new KongoOptions()
            {
                ApplicationStartedOn = DateTimeOffset.UtcNow
            };

            _processor = new LeadersProcessor(storage, opts);
            var processedLeaders = await _processor.ProcessLeaders(value);

            storage.Database.EnsureDeleted();
            Assert.True(processedLeaders.Leaders.Count > 0);
        }
        public async Task ProcessLeadersLogs(string value)
        {
            var storage = new KongoDataStorage($"Data Source={Path.GetRandomFileName()}");

            storage.Database.EnsureCreated();
            var opts = new KongoOptions()
            {
                ApplicationStartedOn = DateTimeOffset.UtcNow
            };

            _processor = new LeadersProcessor(storage, opts);
            var processedLeaders = await _processor.ProcessLeadersLogs(value);

            storage.Database.EnsureDeleted();

            var leadersLogs = JsonConvert.DeserializeObject <List <StoredLeadersLogsModel> >(processedLeaders.LeadersLogsJson);

            Assert.True(leadersLogs.Count > 0);
            Assert.False(leadersLogs[0].Scheduled_at_date.Equals(default));