public void FilteredResultCreatedAfterTest() { using (var testDb = new TestDB(DbConnectionFactory.CreatePersistent("Test"))) { var threeMonthsAgo = DateTime.UtcNow.AddMonths(-3).Ticks; var items = FilteredResultHelpers.ProcessFilters <TestModel>(linqToObjects, new JObject() { { "Created_after", threeMonthsAgo } }); Assert.AreEqual(2, items.Count()); } }
public void FilteredResultCreatedBeforeTest() { using (var testDb = new TestDB(DbConnectionFactory.CreatePersistent("Test"))) { var today = DateTime.UtcNow.Ticks; var items = FilteredResultHelpers.ProcessFilters <TestModel>(linqToObjects, new JObject() { { "Created_before", today } }); Assert.AreEqual(5, items.Count()); } }
public void FilteredResultCreatedBetweenTest() { using (var testDb = new TestDB(DbConnectionFactory.CreatePersistent("Test"))) { var oneMonthAgo = DateTime.UtcNow.AddMonths(-1).Ticks; var fiveMonthsAgo = DateTime.UtcNow.AddMonths(-5).AddDays(-1).Ticks; var items = FilteredResultHelpers.ProcessFilters <TestModel>(linqToObjects, new JObject() { { "Created_after", fiveMonthsAgo }, { "Created_before", oneMonthAgo } }); Assert.AreEqual(3, items.Count()); } }