forked from zzzprojects/System.Linq.Dynamic.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConstantExpressionHelperTests.cs
More file actions
48 lines (40 loc) · 1.7 KB
/
ConstantExpressionHelperTests.cs
File metadata and controls
48 lines (40 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.Linq.Dynamic.Core.Parser;
using System.Threading.Tasks;
using Xunit;
namespace System.Linq.Dynamic.Core.Tests
{
public partial class EntitiesTests
{
//[Fact]
//public async Task TestConstantExpressionLeak()
//{
// //Arrange
// PopulateTestData(1, 0);
// var populateExpression = _context.Blogs.All("BlogId > 2000");
// var expressions = ConstantExpressionHelper.Expressions;
// // Should contain
// if (!expressions.TryGetValue(2000, out _))
// {
// Assert.Fail("Cache was missing constant expression for 2000");
// }
// // wait half the expiry time
// await Task.Delay(TimeSpan.FromSeconds(ConstantExpressionHelper.Expressions.TimeToLive.TotalSeconds/2));
// if (!expressions.TryGetValue(2000, out _))
// {
// Assert.Fail("Cache was missing constant expression for 2000 (1)");
// }
// // wait another half the expiry time, plus one second
// await Task.Delay(TimeSpan.FromSeconds((ConstantExpressionHelper.Expressions.TimeToLive.TotalSeconds / 2)+1));
// if (!expressions.TryGetValue(2000, out _))
// {
// Assert.Fail("Cache was missing constant expression for 2000 (2)");
// }
// // Wait for the slide cache to expire, check on second later
// await Task.Delay(ConstantExpressionHelper.Expressions.TimeToLive.Add(TimeSpan.FromSeconds(1)));
// if (expressions.TryGetValue(2000, out _))
// {
// Assert.Fail("Expected constant to be expired 2000");
// }
//}
}
}