@@ -41,6 +41,10 @@ public void AppliesOptionsToQuery()
41
41
query . Received ( 1 ) . SetCacheMode ( CacheMode . Normal ) ;
42
42
query . Received ( 1 ) . SetCacheRegion ( "testregion" ) ;
43
43
query . Received ( 1 ) . SetTimeout ( 10 ) ;
44
+
45
+ // Prevent garbage collection of session substitute before end of test, since the Linq query provider
46
+ // only has a weak reference on it.
47
+ Assert . That ( session , Is . Not . Null ) ;
44
48
}
45
49
46
50
[ Test ]
@@ -72,6 +76,10 @@ public void DoNotContaminateQueryWithOptions()
72
76
query . Received ( 1 ) . SetCacheMode ( CacheMode . Normal ) ;
73
77
query . Received ( 1 ) . SetCacheRegion ( "testregion" ) ;
74
78
query . Received ( 1 ) . SetTimeout ( 10 ) ;
79
+
80
+ // Prevent garbage collection of session substitute before end of test, since the Linq query provider
81
+ // only has a weak reference on it.
82
+ Assert . That ( session , Is . Not . Null ) ;
75
83
}
76
84
77
85
[ Test ]
@@ -101,6 +109,10 @@ public async Task AppliesOptionsToQueryAsync()
101
109
query . Received ( 1 ) . SetCacheMode ( CacheMode . Normal ) ;
102
110
query . Received ( 1 ) . SetCacheRegion ( "testregion" ) ;
103
111
query . Received ( 1 ) . SetTimeout ( 10 ) ;
112
+
113
+ // Prevent garbage collection of session substitute before end of test, since the Linq query provider
114
+ // only has a weak reference on it.
115
+ Assert . That ( session , Is . Not . Null ) ;
104
116
}
105
117
106
118
[ Test ]
@@ -133,6 +145,10 @@ public async Task DoNotContaminateQueryWithOptionsAsync()
133
145
query . Received ( 1 ) . SetCacheMode ( CacheMode . Normal ) ;
134
146
query . Received ( 1 ) . SetCacheRegion ( "testregion" ) ;
135
147
query . Received ( 1 ) . SetTimeout ( 10 ) ;
148
+
149
+ // Prevent garbage collection of session substitute before end of test, since the Linq query provider
150
+ // only has a weak reference on it.
151
+ Assert . That ( session , Is . Not . Null ) ;
136
152
}
137
153
}
138
154
}
0 commit comments