public void PersistList_ClearsTheListExpirationData() { UseConnection(database => { var list1 = new ListDto { Key = "List1", Value = "value1", ExpireAt = database.GetServerTimeUtc() }; database.List.InsertOne(list1); var list2 = new ListDto { Key = "List2", Value = "value2", ExpireAt = database.GetServerTimeUtc() }; database.List.InsertOne(list2); Commit(database, x => x.PersistList(list1.Key)); var testList1 = GetTestList(database, list1.Key); Assert.Null(testList1.ExpireAt); var testList2 = GetTestList(database, list2.Key); Assert.NotNull(testList2.ExpireAt); }); }
public void ExpireList_SetsListExpirationData() { UseConnection(database => { var list1 = new ListDto { Key = "List1", Value = "value1" }; database.List.InsertOne(list1); var list2 = new ListDto { Key = "List2", Value = "value2" }; database.List.InsertOne(list2); Commit(database, x => x.ExpireList(list1.Key, TimeSpan.FromDays(1))); var testList1 = GetTestList(database, list1.Key); Assert.True(database.GetServerTimeUtc().AddMinutes(-1) < testList1.ExpireAt && testList1.ExpireAt <= database.GetServerTimeUtc().AddDays(1)); var testList2 = GetTestList(database, list2.Key); Assert.Null(testList2.ExpireAt); }); }