コード例 #1
0
        public async Task AddCollectionWithTimeSeriesAsync()
        {
            var utcNow       = SystemClock.UtcNow;
            var yesterdayLog = LogEventGenerator.Generate(ObjectId.GenerateNewId(utcNow.AddDays(-1)).ToString(), createdUtc: utcNow.AddDays(-1));
            var nowLog       = LogEventGenerator.Default;

            var logs = new List <LogEvent> {
                yesterdayLog, nowLog
            };
            await _dailyRepository.AddAsync(logs, o => o.ImmediateConsistency());

            var results = await _dailyRepository.GetByIdsAsync(new List <string> {
                yesterdayLog.Id, nowLog.Id
            });

            Assert.Equal(logs, results.OrderBy(d => d.CreatedUtc).ToList());

            var getAllResults = await _dailyRepository.GetAllAsync();

            Assert.Equal(logs, getAllResults.Documents.OrderBy(d => d.CreatedUtc).ToList());
        }