Example #1
0
        public void On_time_less_or_equal_on_multiple_days()
        {
            PluginBase plugin = new Plugin();
            var        now    = DateTime.Now;

            ((Plugin)plugin)
            .Clear()
            .Add(new LogRow()
            {
                Level  = Guid.NewGuid().ToString(),
                Logger = Guid.NewGuid().ToString(),
                Time   = now.AddMinutes(10)
            }, new LogRow()
            {
                Level  = Guid.NewGuid().ToString(),
                Logger = "group",
                Time   = now.AddDays(-2)
            }, new LogRow()
            {
                Level  = "debug",
                Logger = Guid.NewGuid().ToString(),
                Time   = now.AddDays(-10)
            }).Commit();

            IFilterExpression filter1 = new TimeFilter()
            {
                Operator = "<=", Operand = "10"
            };

            var days = plugin.GetDays();
            var logs = plugin.GetLogs(days.ElementAt(0));

            logs = filter1.Filter(logs).ToList();
            Assert.Single(logs);
        }
Example #2
0
        public void On_time_less_than_or_equal()
        {
            PluginBase        plugin = new Plugin();
            IFilterExpression filter = new TimeFilter()
            {
                Operator = "<=", Operand = "15"
            };

            ((Plugin)plugin).AddMinutes(1);
            var days = plugin.GetDays();

            foreach (var day in days)
            {
                var logs = plugin.GetLogs(day);
                logs = filter.Filter(logs);
                Assert.True(logs.Count() > 0);
            }
        }