Exemple #1
0
        public async Task WhenOmitingThePrevious30Days()
        {
            var resolver = new StaticConnectionStringResolver(new Dictionary <string, string> {
                ["v"] = ConnectionString
            });
            DapperEventLoader loader = new DapperEventLoader(resolver, new DapperLocationLoader(resolver));
            var events = await loader.GetAsync(from : DateTime.Today);

            AreEquivalent(events, Expected.Where(i => i.Start > DateTime.Today).ToArray());
        }
Exemple #2
0
        public async Task WhenRetrievingEventsWithNoDateRange()
        {
            var resolver = new StaticConnectionStringResolver(new Dictionary <string, string> {
                ["v"] = ConnectionString
            });
            DapperEventLoader loader = new DapperEventLoader(resolver, new DapperLocationLoader(resolver));
            var events = await loader.GetAsync();

            AreEquivalent(events, Expected);
        }
Exemple #3
0
        public async Task WhenLimitingToTheNext30Days()
        {
            var resolver = new StaticConnectionStringResolver(new Dictionary <string, string> {
                ["v"] = ConnectionString
            });
            DapperEventLoader loader  = new DapperEventLoader(resolver, new DapperLocationLoader(resolver));
            DateTime          endTime = DateTime.UtcNow.AddDays(31).AddMinutes(-1);
            var events = await loader.GetAsync(to : endTime);

            AreEquivalent(events, Expected.Where(i => i.Start < endTime).ToArray());
        }
Exemple #4
0
        public async Task WhenRequestingById()
        {
            var resolver = new StaticConnectionStringResolver(new Dictionary <string, string> {
                ["v"] = ConnectionString
            });
            DapperEventLoader loader = new DapperEventLoader(resolver, new DapperLocationLoader(resolver));

            var expected = Expected.Skip(5).First();

            var actual = await loader.GetAsync(expected.Id);

            AreEquivalent(new[] { actual }, new[] { expected });
        }
Exemple #5
0
        public async Task WhenRequestingTheCurrentMonth()
        {
            var resolver = new StaticConnectionStringResolver(new Dictionary <string, string> {
                ["v"] = ConnectionString
            });
            DapperEventLoader loader = new DapperEventLoader(resolver, new DapperLocationLoader(resolver));
            DateTime          start  = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, 1, 0, 0, 0, DateTimeKind.Utc);
            DateTime          end    = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.DaysInMonth(DateTime.UtcNow.Year, DateTime.UtcNow.Month), 09, 0, 0, DateTimeKind.Utc);

            var events = await loader.GetAsync(from : start, to : end);

            AreEquivalent(events, Expected.Where(i => i.Start >= start && i.End <= end).ToArray());
        }